entity framework - ASP.NET Core 1 EF - migrations update to latest -
i have 2 migrations in asp.net core 1 mvc project follows:
the v1 migration initial migration 1 table, restaurants.
i added v2 migration now, after added asp.net identity project, , want update db latest migration, getting error table exists.
the restaurant table exist, thought drop-create , add new tables well. none of new tables exist. used following commands create: dnx ef migrations add v2 , update: dnx ef database update, tried specifying v2 keeps trying migrate initial version only.
how second migration update existing database?
update: added third migration, deleted database , reran update migrations command - time v1 , v2 ran, v3 did not. gives?
you need check "dbo.__migrationhistory" table if exists there in database. if not there, delete existing migrations. add new migration , update database. create , sync database model.
if deleting database delete existing migrations. , add new migration. still facing same issue open migration class , search table "restaurant". try figure out:
- it added twice or not
- it added once, comment out , re-run update database command see next error.
Comments
Post a Comment