-
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.
Add a migration script for encrypted trigger kwargs (#38358)
(cherry picked from commit 6f0e5bc)
- Loading branch information
1 parent
6448577
commit c108064
Showing
5 changed files
with
98 additions
and
7 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
airflow/migrations/versions/0140_2_9_0_update_trigger_kwargs_type.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,50 @@ | ||
# | ||
# 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. | ||
|
||
"""update trigger kwargs type | ||
Revision ID: 1949afb29106 | ||
Revises: ee1467d4aa35 | ||
Create Date: 2024-03-17 22:09:09.406395 | ||
""" | ||
import sqlalchemy as sa | ||
|
||
from airflow.models.trigger import Trigger | ||
from alembic import op | ||
|
||
from airflow.utils.sqlalchemy import ExtendedJSON | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "1949afb29106" | ||
down_revision = "ee1467d4aa35" | ||
branch_labels = None | ||
depends_on = None | ||
airflow_version = "2.9.0" | ||
|
||
|
||
def upgrade(): | ||
"""Update trigger kwargs type to string""" | ||
with op.batch_alter_table("trigger") as batch_op: | ||
batch_op.alter_column("kwargs", type_=sa.Text(), ) | ||
|
||
|
||
def downgrade(): | ||
"""Unapply update trigger kwargs type to string""" | ||
with op.batch_alter_table("trigger") as batch_op: | ||
batch_op.alter_column("kwargs", type_=ExtendedJSON(), postgresql_using="kwargs::json") |
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
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 @@ | ||
3ec33f4a14388277f9aba431c06c3bfa9d044ab2eae466aa394aa9618d2f3eb5 | ||
2a24225537326f38be5df14e0b7a8dca867122093e0fa932f1a11ac12d1fb11c |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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