From 2cb3d2aeb7f275fc4decb50a7fd38c401d84087d Mon Sep 17 00:00:00 2001
From: Tzu-ping Chung <uranusjr@gmail.com>
Date: Tue, 16 May 2023 11:39:14 +0800
Subject: [PATCH] Always pass named type_ arg to drop_constraint

It seems Alembic recently starts to enforce this argument being passed
using a keyword (instead of positional). These are failing since the
upstream change.
---
 .../0089_2_2_0_make_xcom_pkey_columns_non_nullable.py         | 2 +-
 .../versions/0093_2_2_0_taskinstance_keyed_to_dagrun.py       | 4 ++--
 .../0100_2_3_0_add_taskmap_and_map_id_on_taskinstance.py      | 4 ++--
 docs/apache-airflow/img/airflow_erd.sha256                    | 2 +-
 docs/apache-airflow/img/airflow_erd.svg                       | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/airflow/migrations/versions/0089_2_2_0_make_xcom_pkey_columns_non_nullable.py b/airflow/migrations/versions/0089_2_2_0_make_xcom_pkey_columns_non_nullable.py
index 68ef900a2db98..9ddfaa12c7646 100644
--- a/airflow/migrations/versions/0089_2_2_0_make_xcom_pkey_columns_non_nullable.py
+++ b/airflow/migrations/versions/0089_2_2_0_make_xcom_pkey_columns_non_nullable.py
@@ -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)
diff --git a/airflow/migrations/versions/0093_2_2_0_taskinstance_keyed_to_dagrun.py b/airflow/migrations/versions/0093_2_2_0_taskinstance_keyed_to_dagrun.py
index 219eb973c1222..ff4e3984655c4 100644
--- a/airflow/migrations/versions/0093_2_2_0_taskinstance_keyed_to_dagrun.py
+++ b/airflow/migrations/versions/0093_2_2_0_taskinstance_keyed_to_dagrun.py
@@ -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")
diff --git a/airflow/migrations/versions/0100_2_3_0_add_taskmap_and_map_id_on_taskinstance.py b/airflow/migrations/versions/0100_2_3_0_add_taskmap_and_map_id_on_taskinstance.py
index d11953009aeed..9cac7cbc01f24 100644
--- a/airflow/migrations/versions/0100_2_3_0_add_taskmap_and_map_id_on_taskinstance.py
+++ b/airflow/migrations/versions/0100_2_3_0_add_taskmap_and_map_id_on_taskinstance.py
@@ -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.
@@ -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)
 
diff --git a/docs/apache-airflow/img/airflow_erd.sha256 b/docs/apache-airflow/img/airflow_erd.sha256
index 596d8925617b6..f3c719fe42d97 100644
--- a/docs/apache-airflow/img/airflow_erd.sha256
+++ b/docs/apache-airflow/img/airflow_erd.sha256
@@ -1 +1 @@
-d3e1272db6e730812ad1c6c317e8de0147aee7b4c02cc33cb096645a408eedd5
\ No newline at end of file
+4995c94849a5848e551e85ffeb99d3dda9f652f3c2d7b3cf3aa16c02911690d3
\ No newline at end of file
diff --git a/docs/apache-airflow/img/airflow_erd.svg b/docs/apache-airflow/img/airflow_erd.svg
index 017bff5c8f755..8439c226f8b98 100644
--- a/docs/apache-airflow/img/airflow_erd.svg
+++ b/docs/apache-airflow/img/airflow_erd.svg
@@ -1232,7 +1232,7 @@
 <g id="edge49" class="edge">
 <title>task_instance&#45;&#45;xcom</title>
 <path fill="none" stroke="#7f7f7f" stroke-dasharray="5,2" d="M1137.01,-506.4C1161.12,-483.83 1186.07,-461.06 1210,-440 1216.27,-434.48 1222.72,-428.89 1229.27,-423.28"/>
-<text text-anchor="start" x="1219.27" y="-412.08" font-family="Times,serif" font-size="14.00">1</text>
+<text text-anchor="start" x="1198.27" y="-412.08" font-family="Times,serif" font-size="14.00">0..N</text>
 <text text-anchor="start" x="1137.01" y="-495.2" font-family="Times,serif" font-size="14.00">1</text>
 </g>
 <!-- task_instance&#45;&#45;xcom -->
@@ -1246,7 +1246,7 @@
 <g id="edge51" class="edge">
 <title>task_instance&#45;&#45;xcom</title>
 <path fill="none" stroke="#7f7f7f" stroke-dasharray="5,2" d="M1137.01,-541.9C1161.12,-519.83 1186.07,-497.06 1210,-476 1223.32,-464.28 1237.48,-452.19 1251.63,-440.12"/>
-<text text-anchor="start" x="1251.63" y="-443.92" font-family="Times,serif" font-size="14.00">0..N</text>
+<text text-anchor="start" x="1241.63" y="-443.92" font-family="Times,serif" font-size="14.00">1</text>
 <text text-anchor="start" x="1137.01" y="-530.7" font-family="Times,serif" font-size="14.00">1</text>
 </g>
 <!-- log_template -->
