Yesterday I came across a scenario where I have added a new migration folder also updated migration with code first migration process. I did following thing to understand the scenario:
DBContextclass and added few classes.
But, later I realize that I don't need this migration and want to revert it back. I thought, I should delete all migration folder and manually revert the database.
So decided to revert from code migration only. As I wanted to revert all db changes done for newly added migration. After few failure I was successfully able to downgrade the database with following command in Nuget Package Manager Console:
Update-Database -ConfigurationType DnpMVCSite.Migrations.QuestionMigration.Configuration –TargetMigration:$InitialDatabase
It completed with following output:
I hope it might helpful for someone.
|Nitya Prakash Sharma has over 10 years of experience in .NET technology. He is currently working as Senior Consultant in industry. He is always keen to learn new things in Technology and eager to apply wherever is possible. He is also has interest in Photography, sketching and painting.