© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
26 replies
Joellao

EF Migrations 101

Hello everyone.
I'm starting a new project and wanted to know why the hell are the migrations so hard to work with. I have the Database entities and a working state of the current implementation. If I need to create a new entity with some relationship it fucks up everything.

The new migration is not updating the db, or it updates the DB but then it complains when inserting data that foreign key constraint is going nuts.

Do you have a preferred way on how to work with this, because deleting all the migration folder and creating a new migration each time I need to add some relationship, doesn't seem the way to deal with this.

Do you guys also set the relationships in the OnModelCreating or you just let ef handle that?

Question and ranting at the same time, sorry for that
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ EF Core migrations
C#CC# / help
4y ago
EF-Core migrations issue
C#CC# / help
2y ago
❔ Code in EF Migrations?
C#CC# / help
4y ago
✅ EF Core migrations with Docker
C#CC# / help
11mo ago