Skip to content

Commit

Permalink
Always pass named type_ arg to drop_constraint (apache#31306)
Browse files Browse the repository at this point in the history
It seems Alembic recently starts to enforce this argument being passed
using a keyword (instead of positional). These are failing since the
upstream change.
  • Loading branch information
uranusjr authored May 16, 2023
1 parent caeca2d commit 4dacab3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def downgrade():
# columns were always non-nullable for mysql, sqlite and postgres, so leave them alone

if conn.dialect.name == "mssql":
bop.drop_constraint("pk_xcom", "primary")
bop.drop_constraint("pk_xcom", type_="primary")
# execution_date and key wasn't nullable in the other databases
bop.alter_column("key", type_=StringID(length=512), nullable=True)
bop.alter_column("execution_date", type_=TIMESTAMP, nullable=True)
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ def downgrade():
if dialect_name == "mssql":

with op.batch_alter_table("dag_run", schema=None) as batch_op:
batch_op.drop_constraint("dag_run_dag_id_execution_date_key", "unique")
batch_op.drop_constraint("dag_run_dag_id_run_id_key", "unique")
batch_op.drop_constraint("dag_run_dag_id_execution_date_key", type_="unique")
batch_op.drop_constraint("dag_run_dag_id_run_id_key", type_="unique")
batch_op.drop_index("dag_id_state")
batch_op.drop_index("idx_dag_run_running_dags")
batch_op.drop_index("idx_dag_run_queued_dags")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def upgrade():
"""
# We need to first remove constraints on task_reschedule since they depend on task_instance.
with op.batch_alter_table("task_reschedule") as batch_op:
batch_op.drop_constraint("task_reschedule_ti_fkey", "foreignkey")
batch_op.drop_constraint("task_reschedule_ti_fkey", type_="foreignkey")
batch_op.drop_index("idx_task_reschedule_dag_task_run")

# Change task_instance's primary key.
Expand Down Expand Up @@ -100,7 +100,7 @@ def downgrade():
op.drop_table("task_map")

with op.batch_alter_table("task_reschedule") as batch_op:
batch_op.drop_constraint("task_reschedule_ti_fkey", "foreignkey")
batch_op.drop_constraint("task_reschedule_ti_fkey", type_="foreignkey")
batch_op.drop_index("idx_task_reschedule_dag_task_run")
batch_op.drop_column("map_index", mssql_drop_default=True)

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 @@
d3e1272db6e730812ad1c6c317e8de0147aee7b4c02cc33cb096645a408eedd5
4995c94849a5848e551e85ffeb99d3dda9f652f3c2d7b3cf3aa16c02911690d3
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 4dacab3

Please sign in to comment.