Fix DB Migration for SQLite to upgrade to 2.0 (#13921)

closes https://github.com/apache/airflow/issues/13877

(cherry picked from commit 7f45e62fdf)
This commit is contained in:
Kaxil Naik 2021-01-29 19:37:10 +00:00
Родитель c62f118e5a
Коммит 669e14d7ee
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -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(