Skip to content
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

Another approach to conflicting migrations #55

Open
ederparaiso opened this issue May 12, 2022 · 3 comments
Open

Another approach to conflicting migrations #55

ederparaiso opened this issue May 12, 2022 · 3 comments

Comments

@ederparaiso
Copy link

Would be awesome if tern has the option to choose how prefix number is generated when create a migration file.
To avoid migration conflicts, "rails like" approach is more simple and effective.
For example, instead generate a sequential number, tern would generate a timestamp numbered prefix, e.g. 20220512190701_create_foo

@jackc
Copy link
Owner

jackc commented May 13, 2022

Timestamp migrations mean the order migrations are actually applied to production is non-deterministic and may never have even occurred once in development or testing.

In addition, it is conceptually much more complicated. Instead of the state of migrations being a single integer it becomes a boolean for every migration.

I've used them in Rails and it was a purposeful choice to avoid them here.

Take a look at #49. tern now has a renumber command to make renumbering conflicts relatively painless.

@ederparaiso
Copy link
Author

Thanks for reply! Actually the way that tern works in this case is a little intrusive in my opinion, conflicts must be resolved aside tern. And I don't think that timestamped migrations are bad. Even in a project with concurrent developers, they much probably won't modify the same domain/table, so the occurrence of conflicts related to execution order of migrations are low and the annoying task to rename files, make another commits, etc could be avoided.

@mcosta74
Copy link

My 2 cents here, the timestamp versioning has a potential problem well described here. Many tools use sequential versioning and some (goose is one of them) allow to have an hybrid approach (timestamp in development and sequence in production).

Honestly I agree that sequence versioning is safer and I prefer to have to fix issue in development instead of discover problems in production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants