EF - Moving from AutomaticMigrations to Manual Migrations

后端 未结 2 600
面向向阳花
面向向阳花 2021-02-05 15:50

End of long day of testing various scenarios where I don\'t have to recreate a production database...

We started off with EF, and didn\'t get wise enough during developm

2条回答
  •  不思量自难忘°
    2021-02-05 16:38

    It should be possible:

    1. Delete the __MigrationHistory table
    2. Delete any migrations in your project
    3. Disable automatic migrations in your migrations configuration class
    4. Add-Migration InitialCreate
    5. Update-Database -Script
    6. Execute the portion of the script that creates the __MigrationHistory table and inserts a row into it
    7. Repeat steps 1 & 6 for any other existing databases

    I also strongly recommend reading Code First Migrations in Team Environments.

提交回复
热议问题