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

Migrations drop and recreate foreign keys - even on "empty" migrations? #4288

Closed
bragma opened this issue Jan 12, 2016 · 3 comments
Closed

Comments

@bragma
Copy link

bragma commented Jan 12, 2016

I'm puzzled by the migrations generated by ef7. It seems that they first drop all FKs, then they create them back. I'm not sure why this is needed. What's even more puzzling is that the migrations generator can't understand a "useless" or "empty" migration, and still generate one even if nothing has changed in the code or DB. Just adding a migration creates code that drop and recreates FKs.
Is understanding if a migration is required totally in developer's hands? I hoped for the generator to understand if anything changed and else report "no migrations needed" or something similar...
If it's not the case, I foresee a lot of troubles ahead. I.e. developer creating migrations just because they don't recall if anything has been changed or forgetting to create migrations.

@flagbug
Copy link

flagbug commented Jan 12, 2016

I'm seeing this too, especially with Asp.Net Identity

See aspnet/Identity#697

@smitpatel
Copy link
Member

dupe of #3751 . It has been fixed already and will ship in RC2.

@bragma
Copy link
Author

bragma commented Jan 12, 2016

Thanks for pointing out the fix. I failed to see the issue closed while searching for clues.

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

4 participants