Skip to content

Commit 3ed69fc

Browse files
committed
Alter task_instance.dag_version_id FK to default on delete.
1 parent 14a5876 commit 3ed69fc

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7d4a160f7d5f4b017496e942255797d8e6b70eeb0d7c861739a66d736f549799
1+
a4f4017347264b506d701f647142ce96f7a1962aacc32d73a70ee4bdc6477e70

airflow-core/docs/migrations-ref.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Here's the list of all the Database Migrations that are executed via when you ru
4040
| Revision ID | Revises ID | Airflow Version | Description |
4141
+=========================+==================+===================+==============================================================+
4242
| ``1b2cd3e4f5a6`` (head) | ``03e36c7f30aa`` | ``3.1.0`` | Modify task_instance.dag_version_id FK on delete behavior to |
43-
| | | | SET NULL. |
43+
| | | | default (no SET NULL). |
4444
+-------------------------+------------------+-------------------+--------------------------------------------------------------+
4545
| ``03e36c7f30aa`` | ``0242ac120002`` | ``3.1.0`` | Add soft-delete flag to DagVersion (is_active). |
4646
+-------------------------+------------------+-------------------+--------------------------------------------------------------+

airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@ def grid_data(
191191
task_node_map_exclude and ti.task_id not in task_node_map_exclude
192192
) or ti.state == TaskInstanceState.REMOVED:
193193
continue
194-
if ti.task_id not in task_node_map:
195-
continue
196194

197195
# Populate the Grouped Task Instances (All Task Instances except the Parent Task Instances)
198196
if ti.task_id in get_child_task_map(

airflow-core/src/airflow/migrations/versions/0072_3_1_0_modify_taskinstance_dag_version_fk.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# under the License.
1717

1818
"""
19-
Modify task_instance.dag_version_id FK on delete behavior to SET NULL.
19+
Modify task_instance.dag_version_id FK on delete behavior to default (no SET NULL).
2020
2121
Revision ID: 1b2cd3e4f5a6
2222
Revises: 03e36c7f30aa
@@ -37,7 +37,7 @@
3737

3838

3939
def upgrade():
40-
"""Alter task_instance.dag_version_id to SET NULL on delete."""
40+
"""Alter task_instance.dag_version_id FK to default on delete."""
4141
with op.batch_alter_table("task_instance", schema=None) as batch_op:
4242
batch_op.drop_constraint(batch_op.f("task_instance_dag_version_id_fkey"), type_="foreignkey")
4343
batch_op.alter_column(
@@ -50,7 +50,6 @@ def upgrade():
5050
"dag_version",
5151
["dag_version_id"],
5252
["id"],
53-
ondelete="SET NULL",
5453
)
5554

5655

airflow-core/src/airflow/models/taskinstance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ class TaskInstance(Base, LoggingMixin):
641641
_task_display_property_value = Column("task_display_name", String(2000), nullable=True)
642642
dag_version_id = Column(
643643
UUIDType(binary=False),
644-
ForeignKey("dag_version.id", ondelete="SET NULL"),
644+
ForeignKey("dag_version.id"),
645645
nullable=True,
646646
)
647647
dag_version = relationship("DagVersion", back_populates="task_instances")

0 commit comments

Comments
 (0)