Lee-W commented on code in PR #51336:
URL: https://github.com/apache/airflow/pull/51336#discussion_r2122396779


##########
airflow-core/src/airflow/migrations/utils.py:
##########
@@ -103,3 +103,20 @@ def mysql_drop_index_if_exists(index_name, table_name, op):
             SELECT 1;
         END IF;
     """)
+
+
+def _sqlite_guarded_drop_constraint(
+    *,
+    table: str,
+    key: str,
+    type_: str,
+    op,
+) -> None:
+    conn = op.get_bind()
+    dialect_name = conn.dialect.name
+    try:
+        with op.batch_alter_table(table, schema=None) as batch_op:
+            batch_op.drop_constraint(key, type_=type_)
+    except ValueError:
+        if dialect_name != "sqlite":
+            raise

Review Comment:
   > I assumed we can’t be more specific than ValueError? (This is too vague to 
my liking.)
   
   We get `ValueError: No such constraint: 'dag_code_pkey'` when migrating so I 
guess this is needed.
   
   yep, this looks better. thanks! let me update it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to