c# - Delete a code-first migration before update-database was run -
this frustratingly simple seeming question has been difficult find answer on google , so. have asp.net mvc project using entity framework code-first approach. went add migration when ran add-migration migrationname
command, misspelled migrationname
.
i have not yet run update-database
. renaming migration class name automatically created enough? or have delete migration first , add new 1 correct name? if so, how do that? delete automatically created migration class or there more it?
while may able rename them, think may come issues regards *.resx
file gets created contains zipped edmx file along naming stuff. simplest way delete root migration class (which remove migration.designer.cs
, migration.resx
file) , recreate it.
if have ran update-database
command, can still achieve rolling back:
update-database -targetmigration nameofpreviousmigration
(you may need add -force
if rollback destroy data)
Comments
Post a Comment