-
Notifications
You must be signed in to change notification settings - Fork 73
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
Merging a branch with duplicate migration numbers #49
Comments
To me it feels like it should be outside of the scope of Perhaps all that tern should do is detect if there are multiple migrations with the same version, and abort ahead of time with a meaningful message, without even attempting to run anything? |
I don't see how it is bad development to have to renumber migrations when working on a branch. If two concurrent branches each have migrations then one of them will need to renumber.
This is what it does now. What I want is to make it easier to fix. Here's another example from a current project of mine of what I am trying to simplify. I have a feature branch with 5 migrations on it. I keep it up to date with master by rebasing on top of master (it'd be the same with merge but I prefer rebase). Every time there is a new migration on master I have to manually renumber those 5 migration files. It's not a big deal but it is an annoying 30 second task that happens fairly frequently. |
Fair enough! I suppose to an interactive shell that allows you to renumber each conflicting migration file is a little more friendly then renumbering by hand. |
Here's a 3rd potential approach. Given I have just rebased branch
This avoids the user having to make any decisions, avoids coding an interactive UI, and avoids VCS integration. The whole thing could be scripted. |
I actually really like this. So say that What if only version 4 was in conflict? do you still push it completely to the back? |
Yes. It would become |
Added |
@jackc it would be great if the core logic of these commands was somehow in |
I agree. Though there are a few complications. The migrate package works in terms of |
It is inconvenient to merge a branch when there are migrations with duplicate numbers. Rails resolved this by moving to timestamp migrations. I dislike this approach because it makes the order migrations are applied non-deterministic. However, it would be nice to have a simpler way to resolve this than manually renaming the offending files.
Broadly speaking there are two directions to go with this.
git add --patch
where it shows each conflict and asks which one comes first.The text was updated successfully, but these errors were encountered: