更新SQL脚本
我有一个使用以下命令来创建数据库的大发应用程序。
dotnet ef migrations script
问题是生成的脚本仅在第一次数据库中有用,其中没有任何内容。我可以运行一个命令来生成更新脚本吗?
I have a Blazor app that I used the following command to create the database.
dotnet ef migrations script
The problem is the script generated is only good for a first time database with nothing in it. Is there a command I can run to generate an update script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
EF中的整个迁移机制是关于数据模型和DB模式之间的一致性。每次更改数据模型时,都应生成新的迁移。
将迁移视为三角洲,其中包含数据库中特定表中添加和删除的信息。如果您在生成的迁移类中查看,很清楚。有与EF相关的方法,可提供有关数据库上SQL修改的抽象层。
迁移>
The whole migrations mechanism in EF is about keeping consistency between your data model and according db schema. Each time your data model changes you should generate new migration.
Think of migrations as of deltas, containing information of what was added and removed from particular tables in your database. It gets pretty clear if you look inside a generated migration class. There are EF related methods providing a layer of abstraction over SQL modifications on databse.
Migrations overview