You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/01/29 19:37:21 UTC

[airflow] branch master updated: Fix DB Migration for SQLite to upgrade to 2.0 (#13921)

This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f45e62  Fix DB Migration for SQLite to upgrade to 2.0 (#13921)
7f45e62 is described below

commit 7f45e62fdf1dd5df50f315a4ab605b619d4b848c
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Fri Jan 29 19:37:10 2021 +0000

    Fix DB Migration for SQLite to upgrade to 2.0 (#13921)
    
    closes https://github.com/apache/airflow/issues/13877
---
 airflow/migrations/versions/cf5dc11e79ad_drop_user_and_chart.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/airflow/migrations/versions/cf5dc11e79ad_drop_user_and_chart.py b/airflow/migrations/versions/cf5dc11e79ad_drop_user_and_chart.py
index d12c78f..b29ce27 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(