( ??? noob sorting things out… ???)
In a table I have a value representing the current schema. This is so client applications can ensure they are running against the right schema.
As per the example, I have multiple files each with a specific set of changes:
Each set is essentially a migration script from Schema X to Schema X+1. Each databaseChangeLog (in the individual files) has a check to ensure the database is the appropriate schema, and if so, it will pass, and the remainder of the changeSet will run:
SELECT [Value] FROM [SYSTEM].[Parameter] WHERE [ParameterName]=‘SchemaVersion’
… changes to get to schema 2 …
Then the last thing the databaseChangeLog does is update the SchemaVersion to the appropriate value.
Now I also have external clients with databases at a particular schema version in the middle, and the migration should be able to handle all previous versions. When I run the migration, it should only run the migration scripts to get up to the latest version (in the above example version 7), regardless of where it started at.
What’s the best why of achieving this? On the databaseChangeLog PreConditions I want to use onFail=“CONTINUE” or “MARK_RAN”, but they’re not options at that level.
Any other ideas?
Thanks in advance.