从EF 5 Code First Migrations生成完整的SQL脚本 [英] Generate full SQL script from EF 5 Code First Migrations
本文介绍了从EF 5 Code First Migrations生成完整的SQL脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Entity Framework 5 Code First Migrations从初始(空)状态到最新迁移创建完整的数据库脚本?
How do I use Entity Framework 5 Code First Migrations to create a full database script from the initial (empty) state to the latest migration?
MSDN博客建议这样做,但似乎创建一个空的脚本:
The blog post at MSDN Blog suggests to do this, but it seems to create an empty script:
Update-Database -Script -SourceMigration: $InitialDatabase
推荐答案
API似乎已更改(或至少对我来说不起作用)。
The API appears to have changed (or at least, it doesn't work for me).
在包管理器控制台中运行以下内容的工作原理如下:
Running the following in the Package Manager Console works as expected:
Update-Database -Script -SourceMigration:0
这篇关于从EF 5 Code First Migrations生成完整的SQL脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文