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.

Upvotes: 0

Views: 3601

Answers (2)

Alluir
Alluir

Reputation: 91

I can give some use cases on when changing the baseline is needed:

  • a schema is created from an older dump (not containing flyway information) and we do not know exactly what should be the baseline.
  • somebody has applied (SQL) migration steps without using flyway, so we have to make flyway aware of that.

Upvotes: 4

markdsievers
markdsievers

Reputation: 7309

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.

Upvotes: 1

Related Questions