知识卡片

普通读书笔记卡 · 3496

迁移记录模式演进

理解等级:中级

数据库模式迁移把表结构的每次变化记录为可追踪步骤,让不同环境按相同顺序重现结构。迁移历史也是发布时检查变更影响的依据;仅修改 ORM 类而不管理实际数据库结构,会使代码模型与已部署模式脱节。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    原书出处

    参考来源

    - 位置:《Microservice APIs》第 7 章《Service implementation patterns for microservices》(源文件:_epub-src/OEBPS/Text/07.htm) - 结论依据:原文定义数据库 schema 变化为 migration,说明迁移历史用于跨环境复制模式和可靠发布,并介绍 Alembic 管理 SQLAlchemy 的迁移。 - 原始内容:Changing the schema of our database is called a migration . As our database evolves, we’ll accumulate more and more migrations. We need to keep track of our migrations, since they allow us to reliably replicate the database schema in different environments and to roll out database changes to production with confidence.