vic*_*vic 6 python sqlalchemy alembic
并非所有数据库迁移都是可逆的.使用Alembic + SQLAlchemy时,是否有(规范)方法"标记"我的downgrade函数/迁移,以便它不能被反转?
比较ActiveRecord迁移,您可以ActiveRecord::IrreversibleMigration从您的down方法提升信号.
提出异常(任何例外)donwgrade会导致降级"干净"失败吗?
一个例外就足够了。这将使迁移失败,并且您将永远无法返回。
def downgrade():
raise Exception("Irreversible migration")
Run Code Online (Sandbox Code Playgroud)