How to add a new code-first migration with a newly-generated database?

前端 未结 2 981
攒了一身酷
攒了一身酷 2021-02-11 05:11

I\'ve enabled code-first migrations on my entity framework project, and have added several migrations which do things like rename tables. However, I have now deleted the databa

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-11 05:38

    Go to MigrationHistory table in sql server (under system folder) it has row for your migration and db hash in it which must be the same with one in your migration file, just copy it from db to file.

    In other words you need to sync your MigrationHistory table with actual migrations.

提交回复
热议问题