Skip to content

Commit

Permalink
Make connection login and password TEXT (apache#32815)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sighery authored Sep 26, 2023
1 parent a169cf2 commit 8e38c5a
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 11 deletions.
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.

"""Make connection login/password TEXT
Revision ID: bd5dfbe21f88
Revises: f7bf2a57d0a6
Create Date: 2023-09-14 17:16:24.942390
"""

import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = "bd5dfbe21f88"
down_revision = "f7bf2a57d0a6"
branch_labels = None
depends_on = None
airflow_version = "2.8.0"


def upgrade():
"""Apply Make connection login/password TEXT"""
with op.batch_alter_table("connection", schema=None) as batch_op:
batch_op.alter_column(
"login", existing_type=sa.VARCHAR(length=500), type_=sa.Text(), existing_nullable=True
)
batch_op.alter_column(
"password", existing_type=sa.VARCHAR(length=5000), type_=sa.Text(), existing_nullable=True
)


def downgrade():
"""Unapply Make connection login/password TEXT"""
with op.batch_alter_table("connection", schema=None) as batch_op:
batch_op.alter_column(
"password", existing_type=sa.Text(), type_=sa.VARCHAR(length=5000), existing_nullable=True
)
batch_op.alter_column(
"login", existing_type=sa.Text(), type_=sa.VARCHAR(length=500), existing_nullable=True
)
4 changes: 2 additions & 2 deletions airflow/models/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class Connection(Base, LoggingMixin):
description = Column(Text().with_variant(Text(5000), "mysql").with_variant(String(5000), "sqlite"))
host = Column(String(500))
schema = Column(String(500))
login = Column(String(500))
_password = Column("password", String(5000))
login = Column(Text())
_password = Column("password", Text())
port = Column(Integer())
is_encrypted = Column(Boolean, unique=False, default=False)
is_extra_encrypted = Column(Boolean, unique=False, default=False)
Expand Down
2 changes: 1 addition & 1 deletion airflow/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"2.6.0": "98ae134e6fff",
"2.6.2": "c804e5c76e3e",
"2.7.0": "405de8318b3a",
"2.8.0": "f7bf2a57d0a6",
"2.8.0": "bd5dfbe21f88",
}


Expand Down
2 changes: 1 addition & 1 deletion docs/apache-airflow/img/airflow_erd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cb63ebc505496790af2d45e0746b4641ed3cc26831f8a5980d8088babaeb43c3
a918c5979b82997b01f55f5a4242a0e6ae8ecc9f316c63ac42f6024c348cdfde
12 changes: 6 additions & 6 deletions docs/apache-airflow/img/airflow_erd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docs/apache-airflow/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 |
+=================================+===================+===================+==============================================================+
| ``f7bf2a57d0a6`` (head) | ``375a816bbbf4`` | ``2.8.0`` | Add owner_display_name to (Audit) Log table |
| ``bd5dfbe21f88`` (head) | ``f7bf2a57d0a6`` | ``2.8.0`` | Make connection login/password TEXT |
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
| ``f7bf2a57d0a6`` | ``375a816bbbf4`` | ``2.8.0`` | Add owner_display_name to (Audit) Log table |
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
| ``375a816bbbf4`` | ``405de8318b3a`` | ``2.8.0`` | add new field 'clear_number' to dagrun |
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
Expand Down

0 comments on commit 8e38c5a

Please sign in to comment.