数据库迁移和视图

发布于 2024-07-19 07:22:24 字数 239 浏览 2 评论 0原文

我正在使用 migrator.net 来处理 SQL Server 的数据库迁移,到目前为止我很喜欢它。 我遇到的唯一问题是如何最好地将更改迁移到视图。 到目前为止,我一直将每个更新作为单独的脚本文件进行管理(它重新创建视图)。 这让我可以返回到视图的先前版本,而无需重复代码。 这种方法目前运行良好,但对视图进行小的更改似乎需要大量工作。 还有其他人遇到过此类问题吗? 是否有任何库可以更稳健地处理视图迁移?

谢谢!

I am using migrator.net to handle database migrations for SQL Server, and I like it so far. The only issue I've run into is how best to migrate changes to views. Thus far, I've been managing each update as a separate script file (which recreates the view). This lets me go back to previous versions of the view without duplicating the code.
This approach is working okay for now, but it seems like a lot of work to make a small change to a view. Has anyone else run into this type of problem? Are there any libraries out there that handle view migrations more robustly?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

澜川若宁 2024-07-26 07:22:24

每当我必须更改视图时,我都会将更改编写为 DROP IF EXISTS 和 CREATE。 这是我的偏好,虽然它似乎比其他方法需要更多工作(ALTER 脚本也可以),但正如您所建议的,它允许版本控制。

Whenever I have to change a view, I script the change into a DROP IF EXISTS and CREATE. That's my preference, and while it seems to be more work than other methods (ALTER scripts also work), it allows version control, as you suggest.

掀纱窥君容 2024-07-26 07:22:24

视图作为文本块存储在 SQL Server 中,因此您可以重新引用它们。 我不记得你能找到它们的表格和列是什么。 但基本上这就是我的理解,我们没有命令来更新过程中的奇数行。

Views get stored in SQL Server as a block of text, so you can refer back to them. I can't remember what the table and column is where you will find them. But basically that's how I understand we do not have commands to update the odd line in the proc.

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