并非所有数据库迁移都是可逆的。当使用Alembic + SQLAlchemy时,是否有(规范的)方式标记"标记"我的downgrade
函数/迁移使它无法逆转?
比较down
方法中的ActiveRecord migrations where you can raise ActiveRecord::IrreversibleMigration
来表示这一点。
在donwgrade
中引发异常(任何异常)会导致降级失败"干净地"?
答案 0 :(得分:3)
一个例外就足够了。它将无法迁移,您将永远无法返回。
def downgrade():
raise Exception("Irreversible migration")