-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfaec5d
commit 7940140
Showing
12 changed files
with
64 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
airflow/migrations/versions/0042_3_0_0_create_fks_as_datasets_are_renamed.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# 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. | ||
|
||
""" | ||
create foreign key constraints for assets. | ||
Revision ID: c4a1639f0f67 | ||
Revises: 05234396c6fc | ||
Create Date: 2024-11-22 09:49:41.813016 | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "c4a1639f0f67" | ||
down_revision = "05234396c6fc" | ||
branch_labels = None | ||
depends_on = None | ||
airflow_version = "3.0.0" | ||
|
||
|
||
def upgrade(): | ||
"""Apply create foreign key constraints for assets.""" | ||
with op.batch_alter_table("asset_dag_run_queue", schema=None) as batch_op: | ||
batch_op.create_foreign_key("adrq_asset_fkey", "asset", ["asset_id"], ["id"], ondelete="CASCADE") | ||
|
||
with op.batch_alter_table("task_outlet_asset_reference", schema=None) as batch_op: | ||
batch_op.create_foreign_key("toar_asset_fkey", "asset", ["asset_id"], ["id"], ondelete="CASCADE") | ||
|
||
|
||
def downgrade(): | ||
"""Unapply create foreign key constraints for assets.""" | ||
with op.batch_alter_table("task_outlet_asset_reference", schema=None) as batch_op: | ||
batch_op.drop_constraint("toar_asset_fkey", type_="foreignkey") | ||
|
||
with op.batch_alter_table("asset_dag_run_queue", schema=None) as batch_op: | ||
batch_op.drop_constraint("adrq_asset_fkey", type_="foreignkey") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
b12f6811bb7a340362e4b8774b3bb81db28a7d0258564b3431bd537368554cc3 | ||
7173ce2b98bc53467274ebe89bd3d4c8e7672f7b40b3f22989139ece45741f8f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters