Skip to content

Commit

Permalink
Don't run pre-migration checks for downgrade (#23634)
Browse files Browse the repository at this point in the history
These checks are only make sense for upgrades.  Generally they exist to resolve referential integrity issues etc before adding constraints.  In the downgrade context, we generally only remove constraints, so it's a non-issue.

(cherry picked from commit 9ab9cd4)
  • Loading branch information
dstandish authored and ephraimbuddy committed May 17, 2022
1 parent f62101b commit d836cd1
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions airflow/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -1504,16 +1504,6 @@ def downgrade(*, to_revision, from_revision=None, show_sql_only=False, session:
log.info("Attempting downgrade to revision %s", to_revision)
config = _get_alembic_config()

errors_seen = False
for err in _check_migration_errors(session=session):
if not errors_seen:
log.error("Automatic migration failed. You may need to apply downgrades manually. ")
errors_seen = True
log.error("%s", err)

if errors_seen:
exit(1)

with create_global_lock(session=session, lock=DBLocks.MIGRATIONS):
if show_sql_only:
log.warning("Generating sql scripts for manual migration.")
Expand Down

0 comments on commit d836cd1

Please sign in to comment.