I have created a lot of migrations while I was developing my domain model. I would like to delete all of them and replace with a new one that will consist final form of my domain model. Is this possible? Thanks in advance.
Asked
Active
Viewed 261 times
1
-
4Possible duplicate of [Reset Entity-Framework Migrations](http://stackoverflow.com/questions/11679385/reset-entity-framework-migrations) – The One Feb 04 '16 at 14:16
-
I am not able to find __MigrationHistory table in my database. If I find it, I would like to delete only migrations that related to my last added domain model, not for all. – ruud Feb 04 '16 at 14:28
-
@ruud - You can't create multiple migrations without applying them, so you should have a __MigrationHistory table. In your question you say you want to delete them all, but in your comment you say you only want to remove the ones related to the "last added domain model". Need to clarify that. Here is a link on how to roll up a bunch of migrations into a single migration: http://cpratt.co/migrating-production-database-with-entity-framework-code-first/#at_pco=smlwn-1.0&at_si=54ad5c7b61c48943&at_ab=per-12&at_pos=0&at_tot=1 – Steve Greene Feb 04 '16 at 15:05
1 Answers
-1
Yes, it's possible! You can manually delete the migration class files in the right side of Visual Studio.
Go to the console manager and type
Add-Migration NewestMigration //You can name it whatever you want by the way.

TJ Riceball
- 240
- 1
- 2
- 11