是否有运行数据库迁移的指南?

发布于 2024-10-10 10:10:29 字数 250 浏览 0 评论 0原文

我正在增强现有的 Web 应用程序,并且创建了一个新的数据库架构。因此,我需要进行数据库迁移,将数据从旧数据库模式传输到新数据库模式,并逐步更新应用程序。因此,我们的想法是,一开始只有少数服务会更新,其他服务将继续像以前一样工作。

您有什么建议、资源、例子可以帮助我吗?如果我现在必须在不检查您的答案的情况下执行此操作,我将手动完成第一个任务(使用 SELECT),并且我将使用 sql 视图(虚拟表)来执行第二个任务。

还有比这更好的吗?让我知道...

I am enhancing an existing web application and I have created a new database schema. So I need to do a database migration that will transfer the data from the old database schema to the new one, and also to update the application progressively. So the idea is that at the beginning only few services will be updated, others will just continue to work as they were before.

Do you have any advices, resources, examples that can help me with that ? If I had to do it now without checking your answers, I would have done the first task manually (using SELECT) and I would have used sql views (virtual tables) for the second task.

Anything better than that ? Let me know...

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

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

发布评论

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

评论(1

路弥 2024-10-17 10:10:29
  1. 如果迁移失败,新数据库和旧数据库不会发生变化。
  2. 验证旧数据的有效性。如果人类在数据库中放入任何内容,则可能存在问题。您需要找到这些异常,并可能在大部分数据输入后将它们放在一边处理它们。
  3. 验证计数并比较数据以确保您获得所需的所有内容。
  4. 保留旧数据库,以防万一。
  1. Make it so that if the migration fails the new DB and old DB are unchanged.
  2. Verify validity of old data. If there is anything humans put in the database there are probably problems with it. You need to find these exceptions and probably set them a side to deal with them after most of the data is in.
  3. Verify counts and compare data to make sure you got all the things you wanted.
  4. Keep the old database, just in case.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文