I am using EF Code First with Migrations.
After i downgrade to a migration version, should i delete all the others that has been created after that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Deleting the forward-migrations will work just fine, if that’s what you’d like to do. The next time you run an add-migration, it will find what has changed in comparison to the now-current migration. One thing I can think of is that if you are working in a team, you’ll need to make sure everyone is on board with deleting the forward-migrations at the same time.
When you downgrade, the “Down” method is ran in each of the forward-migrations, and also they are removed from the _MigrationHistory table.
Alternatively, you could change your model back to what it was at your target migration and then do an add-migration – that will effectively revert your database.