Skip to content

Commit

Permalink
fixup! Fix mysql, sqlite and issue with cascading deletes
Browse files Browse the repository at this point in the history
  • Loading branch information
ephraimbuddy committed Apr 16, 2024
1 parent 0d7c1f6 commit 471afcb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def upgrade():
# SQLite does not support DROP CONSTRAINT
return
if conn.dialect.name == "mysql":
op.execute("ALTER TABLE connection DROP INDEX IF EXISTS unique_conn_id")
op.drop_index('unique_conn_id', table_name='connection', if_exists=True)
# Dropping and recreating cause there's no IF NOT EXISTS
op.execute("ALTER TABLE connection DROP INDEX IF EXISTS connection_conn_id_uq")
op.drop_index('connection_conn_id_uq', table_name='connection', if_exists=True)
else:
op.execute("ALTER TABLE connection DROP CONSTRAINT IF EXISTS unique_conn_id")
# Dropping and recreating cause there's no IF NOT EXISTS
Expand All @@ -64,11 +64,11 @@ def upgrade():
batch_op.drop_constraint("task_reschedule_dr_fkey", type_="foreignkey")

if conn.dialect.name == "mysql":
op.execute("ALTER TABLE dag_run DROP INDEX IF EXISTS dag_run_dag_id_execution_date_uq")
op.execute("ALTER TABLE dag_run DROP INDEX IF EXISTS dag_run_dag_id_run_id_uq")
op.drop_index('dag_run_dag_id_execution_date_uq', table_name='dag_run', if_exists=True)
op.drop_index('dag_run_dag_id_run_id_uq', table_name='dag_run', if_exists=True)
# below we drop and recreate the constraints because there's no IF NOT EXISTS
op.execute("ALTER TABLE dag_run DROP INDEX IF EXISTS dag_run_dag_id_execution_date_key")
op.execute("ALTER TABLE dag_run DROP INDEX IF EXISTS dag_run_dag_id_run_id_key")
op.drop_index('dag_run_dag_id_execution_date_key', table_name='dag_run', if_exists=True)
op.drop_index('dag_run_dag_id_run_id_key', table_name='dag_run', if_exists=True)
else:
op.execute("ALTER TABLE dag_run DROP CONSTRAINT IF EXISTS dag_run_dag_id_execution_date_uq")
op.execute("ALTER TABLE dag_run DROP CONSTRAINT IF EXISTS dag_run_dag_id_run_id_uq")
Expand Down
2 changes: 1 addition & 1 deletion docs/apache-airflow/img/airflow_erd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0d18bba1555dd5927812aeed569b37eb871d41c79921e510fa3e83f844e0f30e
320570337a9f2b7f0a118ca22e86633df6d6a1ac5712add285cf2807c0382ef6
4 changes: 2 additions & 2 deletions docs/apache-airflow/img/airflow_erd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 471afcb

Please sign in to comment.