diff --git a/airflow/migrations/versions/cf5dc11e79ad_drop_user_and_chart.py b/airflow/migrations/versions/cf5dc11e79ad_drop_user_and_chart.py index d12c78ff9e..b29ce27070 100644 --- a/airflow/migrations/versions/cf5dc11e79ad_drop_user_and_chart.py +++ b/airflow/migrations/versions/cf5dc11e79ad_drop_user_and_chart.py @@ -47,7 +47,9 @@ def upgrade(): # noqa: D103 if 'known_event' in tables: for fkey in inspector.get_foreign_keys(table_name="known_event", referred_table="users"): - op.drop_constraint(fkey['name'], 'known_event', type_="foreignkey") + if fkey['name']: + with op.batch_alter_table(table_name='known_event') as bop: + bop.drop_constraint(fkey['name'], type_="foreignkey") if "chart" in tables: op.drop_table(