From d45ab439e9ecc20bacee5ae8986f04bc35f52202 Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Thu, 9 Apr 2026 11:24:03 +0800 Subject: [PATCH] [v3-2-test] fix(migrations): move UPDATEs inside disable_sqlite_fkeys in migration 0097 (#64876) (cherry picked from commit 666879c6735a08296e4d407709f50a0efe894eff) Co-authored-by: Wei Lee --- ..._3_2_0_enforce_log_event_and_dag_is_stale_not_null.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/airflow-core/src/airflow/migrations/versions/0097_3_2_0_enforce_log_event_and_dag_is_stale_not_null.py b/airflow-core/src/airflow/migrations/versions/0097_3_2_0_enforce_log_event_and_dag_is_stale_not_null.py index 49fb4bcc3f7ac..5af4f7be74d62 100644 --- a/airflow-core/src/airflow/migrations/versions/0097_3_2_0_enforce_log_event_and_dag_is_stale_not_null.py +++ b/airflow-core/src/airflow/migrations/versions/0097_3_2_0_enforce_log_event_and_dag_is_stale_not_null.py @@ -40,13 +40,10 @@ def upgrade(): """Bring existing deployments in line with 0010 and 0067.""" - # Ensure `log.event` can safely transition to NOT NULL. - op.execute("UPDATE log SET event = '' WHERE event IS NULL") - - # Make sure DAG rows that survived the old 0067 path are not NULL. - op.execute("UPDATE dag SET is_stale = false WHERE is_stale IS NULL") - with disable_sqlite_fkeys(op): + op.execute("UPDATE log SET event = '' WHERE event IS NULL") + op.execute("UPDATE dag SET is_stale = false WHERE is_stale IS NULL") + with op.batch_alter_table("log") as batch_op: batch_op.alter_column("event", existing_type=sa.String(60), nullable=False)