更新SQL脚本

发布于 2025-01-30 08:35:22 字数 139 浏览 3 评论 0原文

我有一个使用以下命令来创建数据库的大发应用程序。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眸中客 2025-02-06 08:35:22

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文