I read the article related to Existing database setup but I still didn't get it.
I already have a postgresql database with a lot of data, and I would like to have a migration tool to keep track of my database schema. From what I understand from that link (in my case, using postgresql) I just have to do "pg_dump -s ..." (which will dump schemas, tables, ... but not data from tables, in sql format), name it as "V1__Baseline_version.sql" and add it to the /sql directory. This will be the baseline version for my existent database:
$ flyway baseline -Dflyway.baselineVersion=1 -Dflyway.baselineDescription="Base version"
The above command will create an additional table in my database to keep track of migrations.
Note: I don't want to add any reference data, just to keep track of db schema changes
Now, any new changes to my schema should be added for example to /sql/V2__Add_some_changes.sql and run:
$ flyway migrate
and this will migrate my existing database to V2.
... and so on, V3 ...Vx
Can somebody confirm that it is the right approach?
Edit: one more question: Having multiple machines, development/testing/staging/production I can use the same set of sql scripts (stored in one common /sql) to keep their db schema in "sync", and just do for each: "flyway baseline ..." + "flyway migrate".