jscheffl commented on code in PR #58852:
URL: https://github.com/apache/airflow/pull/58852#discussion_r2661646908


##########
airflow-core/src/airflow/migrations/versions/0097_3_2_0_add_timetable_type_to_dag_table_for_.py:
##########
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+add timetable_type to dag table for filtering.
+
+Revision ID: e79fc784f145
+Revises: c47f2e1ab9d4
+Create Date: 2026-01-04 14:36:04.648869
+
+"""
+
+from __future__ import annotations
+
+import sqlalchemy as sa
+from alembic import op
+
+# revision identifiers, used by Alembic.
+revision = "e79fc784f145"
+down_revision = "c47f2e1ab9d4"
+branch_labels = None
+depends_on = None
+airflow_version = "3.2.0"
+
+
+def upgrade():
+    """Apply add timetable_type to dag table for filtering."""
+    # ### commands auto generated by Alembic - please adjust! ###
+    with op.batch_alter_table("dag", schema=None) as batch_op:
+        # Add column as nullable first to allow filling existing rows
+        batch_op.add_column(sa.Column("timetable_type", sa.String(length=255), 
nullable=False))

Review Comment:
   Okay, now as a follow-up you only have a problem if Dags are existing (wich 
probably are) that a non nullable column will miss values. So most probably you 
(1) need to add the column nullable, then (2) fill some data which is transient 
and over-written by next dag parsing cycle and finally (3) make the column non 
null.



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