❔ Entity Framework Migrations
So I deleted a migration or 2, which I've come to learn from the docs was a bad move.
The migrations I deleted were all the top of the list (ie most recents) but my context snapshot and migrations are out of sync now.
Is there a way I can run through those migrations, and create a context snapshot from them?
I'm pretty sure there's a way to create code from a db, and you can create a db from the migrations, so there must be a way...
3 Replies
You are doing code first right? Can't you delete all the migrations and redo the initial? It should redo based on your current model setup.
Maybe backup the current files instead of just deleting outright
You might also need to clear the migration history table in the db (according to how you're setup)
well ideally the goal is to keep the migrations that are there, and not delete them all and start over
I had branched off from dev at the start though
So I thought that taking the context snapshot of dev, and copy pasting it into my new branch, should give me the correct offset but perhaps not
I got it working
doing what I said above works perfectly
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.