Validate that EF Core ModelSnapshot, migrations, and actual database schema are consistent with each other

前端 未结 1 1805
闹比i
闹比i 2021-01-25 07:19

I am using EF Core. After \"cleverly\" merging a couple of source control branches that both introduced migrations, I\'m no longer confident that my ModelSnapshot is consistent

相关标签:
1条回答
  • 2021-01-25 07:24

    Here are tools you can use to perform some sanity checks.

    • Add-Migration will show any differences between your current model and the model snapshot
    • Script-Migration will produce a SQL script you can use to create a database from the migrations
    • CreateDatabaseScript will produce a SQL script you can use to create a database from the model
    • SQL Server Data Tools can compare two databases
    • Scaffold-DbContext will create a model that is compatible with a database
    0 讨论(0)
提交回复
热议问题