-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for sequential numbering of migrations #25
Comments
@przemyslaw-dobrowolski-cl I'm just starting to use goose today, but doesn't goose already add a timestamp to migration filenames and execute migrations in order of timestamp?
This is how Ruby on Rails also does it. Does that not work? |
Hi @joelpresence , |
The order of the migrations is deterministic, it is determined by the timestamp (unless they happen to create both migrations at the exact same time, but then you'll get an error). When the second developer merges or rebases their code (after the first developer has already pushed their new migration), they have to check that the merged code still works. Checking the migrations is part of that. Your CI should also create an empty database, run all the migrations, then run the tests. If the migrations conflict, that should catch it. I don't think this solution is a good idea. What happens if one developer uses create, and the other uses create-next? |
@nkovacs I agree. We don't use timestamps here at Pressly. Instead, we use numbers like Travis fails when we have any conflicting migrations and won't allow us to merge. But I wish there was some automation for renaming the conflicting migrations. |
Fixed in #50 |
When two or more developers decide to create a new migration at the same revision in a project, the order of migration is non-deterministic (according to the moment when they create migration template).
This problem can be resolved by extending goose with an option to create sequential migrations (i.e create-next) which always determine the next sequence number as the most recent existing migration version plus one. With this procedure, a possible race in migrations versioning will be resolved by CI or repository because a migration with the target version may already exist.
The text was updated successfully, but these errors were encountered: