EF - Generate script from previous migration

时间:2016-02-03 03:54:51

标签: entity-framework entity-framework-5 ef-migrations

I want to update database schema on production database. Usually in my development I just do Add-Migration and Update-Database.

My question is how to generate script so I can manually read through the query before executing in production environment? I've tried Update-Database -script but it gave me No pending explicit migrations.

1 个答案:

答案 0 :(得分:3)

尝试跑步:

Update-Database -Script -SourceMigration: <initial-migration> -TargetMigration: <latest-migration>

显然,请使用相应的迁移名称替换<initial-migration><latest-migration>

这应该立即生成所有迁移的脚本。

更多信息can be found here on MSDN.