Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow-core/docs/img/airflow_erd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
42a5f9219ef3dac4f12b20c3e11557c2aba2602e8f41c5858501ad5e5f82df7e
290d11c38dc1b90c852ee03a4d5c11c078fe95de9667cede863e7ad30e19573f
4 changes: 3 additions & 1 deletion airflow-core/docs/migrations-ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ Here's the list of all the Database Migrations that are executed via when you ru
+-------------------------+------------------+-------------------+--------------------------------------------------------------+
| Revision ID | Revises ID | Airflow Version | Description |
+=========================+==================+===================+==============================================================+
| ``ab6dc0c82d0e`` (head) | ``15d84ca19038`` | ``3.2.0`` | Change ``serialized_dag`` data column to JSONB for |
| ``1b2c3d4e5f6g`` (head) | ``ab6dc0c82d0e`` | ``3.2.0`` | Add length to dag_bundle_team.dag_bundle_name. |
+-------------------------+------------------+-------------------+--------------------------------------------------------------+
| ``ab6dc0c82d0e`` | ``15d84ca19038`` | ``3.2.0`` | Change ``serialized_dag`` data column to JSONB for |
| | | | PostgreSQL. |
+-------------------------+------------------+-------------------+--------------------------------------------------------------+
| ``15d84ca19038`` | ``cc92b33c6709`` | ``3.2.0`` | replace asset_trigger table with asset_watcher. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# 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 length to dag_bundle_team.dag_bundle_name.

Revision ID: ab6dc0c82d0eg
Revises: ab6dc0c82d0e
Create Date: 2025-09-22 12:34:56.000000

"""

from __future__ import annotations

from alembic import op

from airflow.migrations.db_types import StringID

# revision identifiers, used by Alembic.
revision = "1b2c3d4e5f6g"
down_revision = "ab6dc0c82d0e"
branch_labels = None
depends_on = None
airflow_version = "3.2.0"


def upgrade():
with op.batch_alter_table("dag_bundle_team") as batch_op:
batch_op.alter_column(
"dag_bundle_name",
type_=StringID(length=250),
existing_nullable=False,
)


def downgrade():
with op.batch_alter_table("dag_bundle_team") as batch_op:
# revert to plain StringID() without length (works on Postgres, fails on MySQL)
batch_op.alter_column(
"dag_bundle_name",
type_=StringID(),
existing_nullable=False,
)
2 changes: 1 addition & 1 deletion airflow-core/src/airflow/models/dagbundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class DagBundleModel(Base, LoggingMixin):
"""

__tablename__ = "dag_bundle"
name = Column(StringID(), primary_key=True, nullable=False)
name = Column(StringID(length=250), primary_key=True, nullable=False)
active = Column(Boolean, default=True)
version = Column(String(200), nullable=True)
last_refreshed = Column(UtcDateTime, nullable=True)
Expand Down
11 changes: 8 additions & 3 deletions airflow-core/src/airflow/models/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from sqlalchemy.orm import relationship
from sqlalchemy_utils import UUIDType

from airflow.models.base import Base
from airflow.models.base import Base, StringID
from airflow.utils.session import NEW_SESSION, provide_session

if TYPE_CHECKING:
Expand All @@ -33,8 +33,13 @@
dag_bundle_team_association_table = Table(
"dag_bundle_team",
Base.metadata,
Column("dag_bundle_name", ForeignKey("dag_bundle.name", ondelete="CASCADE"), primary_key=True),
Column("team_id", ForeignKey("team.id", ondelete="CASCADE"), primary_key=True),
Column(
"dag_bundle_name",
StringID(length=250),
ForeignKey("dag_bundle.name", ondelete="CASCADE"),
primary_key=True,
),
Column("team_id", UUIDType(binary=False), ForeignKey("team.id", ondelete="CASCADE"), primary_key=True),
Index("idx_dag_bundle_team_dag_bundle_name", "dag_bundle_name", unique=True),
Index("idx_dag_bundle_team_team_id", "team_id"),
)
Expand Down