我应该担心在使用 Flyway 时创建幂等迁移吗?
Should I be worried about creating idempotent migrations while using Flyway?
我一直在阅读一篇名为 Lessons Learned Using Flyway DB with Distributed Version Control 的关于 Flyway 的博客 post。作者的建议之一是创建幂等迁移。
引用文章:
In a perfect world, each migration will only be run once against each
database.
In a perfect world, that is.
In actuality, there will be cases where you’ll need to re-run
migrations against the same database. Often this will be due to a
failed migration somewhere along the line, causing you to have to
retrace your steps of successful migrations before to get the database
back in a working state. When this happens, it’s incredibly helpful
for the migration to be written in an idempotent manner.
假设我正在使用支持 DDL 事务的数据库,我是否应该担心创建这些迁移 sql 时的幂等性问题?
一般不会,尤其是当您有一个支持 DDL 事务的数据库时。
版本化迁移旨在 运行 恰好一次并且可以,但不必是幂等的(实际上没有任何好处)。
另一方面,可重复迁移必须是幂等的,因为它们会 运行 一遍又一遍。
Flyway 让您可以非常轻松地从头开始重新创建数据库,这是您在试验时应该喜欢的方法。
我一直在阅读一篇名为 Lessons Learned Using Flyway DB with Distributed Version Control 的关于 Flyway 的博客 post。作者的建议之一是创建幂等迁移。
引用文章:
In a perfect world, each migration will only be run once against each database.
In a perfect world, that is.
In actuality, there will be cases where you’ll need to re-run migrations against the same database. Often this will be due to a failed migration somewhere along the line, causing you to have to retrace your steps of successful migrations before to get the database back in a working state. When this happens, it’s incredibly helpful for the migration to be written in an idempotent manner.
假设我正在使用支持 DDL 事务的数据库,我是否应该担心创建这些迁移 sql 时的幂等性问题?
一般不会,尤其是当您有一个支持 DDL 事务的数据库时。
版本化迁移旨在 运行 恰好一次并且可以,但不必是幂等的(实际上没有任何好处)。
另一方面,可重复迁移必须是幂等的,因为它们会 运行 一遍又一遍。
Flyway 让您可以非常轻松地从头开始重新创建数据库,这是您在试验时应该喜欢的方法。