schemachange
schemachange copied to clipboard
Script not executed based on version control
When multiple developers work we get to a problem that one of them merge a script with version control for instance 50 The other developer is still working on a version 40, even if he merges that deploy will be skipped since: Max applied change script version: 50 We use Snowflake sequence to get unique version number not to mess up and have same versions, but in this case this doesn't work. Is this expected and we also need to keep track to use larger value compared to last deployment or not?
Bumping this one because I just ran into the same problem.
- The latest deployed change is version 10.
- Developer A creates version 11 and starts working on it.
- Developer B creates version 12 and starts working on it.
- Developer B's changes are ready and get deployed to production. Now the latest version in production is 12.
- Developer A's changes are ready for production, but schemachange won't deploy them because 12 > 11.
How are we supposed to manage this? Nobody can guarantee the sequencing of changes going into any particular environment, and I don't want to have to rename a bunch of files as prep for entering any environment.
We too have the same issue. @sfc-gh-jhansen can you please just confirm this is the expected behavior or if we're probably overlooking something ?
This is the expected behavior, and is the default behavior for Flyway as well. Flyway does offer an "out of order" setting to allow for situations like this. The reason it's like this is to help ensure dependency order is met, but customers do run into the challenge you described. Need to think through the risks of allowing out of order executions.
The manual solution, although a bit of a pain, is to rename the script with the next version number in these situations.
Again, need to think through the implications/risks of running out of order. In that case, the version number really looses a bunch of its meaning. It no longer guarantees that all scripts run in a specific order.