How can I stop Add-Migration checking my database has no pending migrations when using Code-Based migrations?

蓝咒 提交于 2019-11-29 10:26:48

Try commenting out your existing migrations (the ones that haven't been applied to the database created on .\SQLExpress) and re-running your app. That should populate the local database with the initial tables it needs.

Once the local database has the correct structure you should be able to uncomment your migrations and then use update-database to bring the local one up to date. Then you'll be able to add a new migration.

Also remember that there's a -connectionString parameter on the update-database command, so you can target your migrations at a specific server/db.

I was seeing this error until I deleted from the Solution the original auto-generated migration code that the Package Manager had initially created.

This would have been 201206260845338_DannyTest.cs in Danny's case.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!