Search code examples
javadatabaseflyway

Changing the baseline record for flyway


I have a database which I run migrations using flyway on. It has a schema_version table that has a record:

'1', '1', '1', '<< Flyway Baseline >>', 'BASELINE', '<< Flyway Baseline >>', NULL, 'root', '2016-06-28 16:59:05', '0', '1'

Now I need to introduce some earlier migrations than 1, ex: 0.0.1. These migrations are ignored because the baseline is 1. Can I change the baseline record in the schema_version table?

Note: I use java api.

Thank you.


Solution

  • No.

    Seems like a confusing request though - you want to add in migrations that should be run but are also pre-baseline (which means they shouldn't be run).

    What you will have to do is delete your schema_version and run baseline + migrate again with your new baselineVersion.

    You could manually tweak the baseline entry in schema_version but I wouldn't recommend that.