Not all database migrations are reversible. When using Alembic+SQLAlchemy, is there a (canonical) way to "mark" my downgrade
function/migration so that it cannot be reversed?
Compare ActiveRecord migrations where you can raise ActiveRecord::IrreversibleMigration
from your down
method to signal this.
Would raising an exception (any exception) in donwgrade
cause the downgrade to fail "cleanly"?
An exception is enough. It will fail the migration and you will never be able to go back.
def downgrade():
raise Exception("Irreversible migration")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With