iting0321 commented on code in PR #64838:
URL: https://github.com/apache/airflow/pull/64838#discussion_r3045408885


##########
airflow-core/src/airflow/migrations/utils.py:
##########
@@ -54,9 +54,10 @@ def get_mssql_table_constraints(conn, table_name) -> 
dict[str, dict[str, list[st
 @contextmanager
 def disable_sqlite_fkeys(op):
     if op.get_bind().dialect.name == "sqlite":
-        op.execute("PRAGMA foreign_keys=off")
-        yield op
-        op.execute("PRAGMA foreign_keys=on")
+        with contextlib.ExitStack() as exit_stack:
+            op.execute("PRAGMA foreign_keys=off")
+            exit_stack.callback(op.execute, "PRAGMA foreign_keys=on")
+            yield op

Review Comment:
   In `0082_3_1_0_make_bundle_name_not_nullable.py` replaced a manual ExitStack 
+ PRAGMA foreign_keys=OFF/ON pattern with disable_sqlite_fkeys(op).



-- 
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