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

后端 未结 2 694
情话喂你
情话喂你 2020-12-19 07:07

I\'m investigating using Code-Based EF Migrations for a product that does not use EF. Everything generally works well, except that the command:

Add-         


        
2条回答
  •  忘掉有多难
    2020-12-19 07:56

    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.

提交回复
热议问题