-
Notifications
You must be signed in to change notification settings - Fork 102
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
Fail migration with error if DB contains unknown migrations. #37
Fail migration with error if DB contains unknown migrations. #37
Conversation
If gormigrate finds migrations in the table that aren't in the provided list then it is likely the software is pointed at the wrong DB or somehow older code is running. Either way, we should not continue to work with this DB without human intervention.
a712055
to
6746c35
Compare
Hi @mdales, Thanks for opening this pull request! I have mixed feeling for this proposal. I agree that this may be useful for some people, but I think we should have a flag to enable this, and it should default to There's two reasons for this:
|
Thanks for the feedback @andreynering, much appreciated. Happy to add the flag with an off default, will update the PR shortly (along with additional tests). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If gormigrate finds migrations in the DB table that aren't in the code provided list then it is likely the software is pointed at the wrong DB or somehow older code is running. Either way, we should not continue to work with this DB without human intervention.
I actually hit this in a production situation, and it was confusing as to why things were failing down the line (as the DB didn't match the model). I'd like to make it an explicit failure rather than something caught later.
Very happy to fix/improve things