From 6a527c9facc649b3d64f36459cd655bcb03a9cb1 Mon Sep 17 00:00:00 2001 From: Ephraim Anierobi Date: Sat, 21 Sep 2024 00:15:44 +0100 Subject: [PATCH] Fix pre-commit for auto update of fab migration versions (#42382) * Fix pre-commit for auto update of fab migration versions This fixes the pre-commit for updating the version in FAB migration and also, updated the actual version as 1.4 since that's going to be the next version At the same time, added Daniel's fix for airflow alembic.ini file * fixup! Fix pre-commit for auto update of fab migration versions * fixup! fixup! Fix pre-commit for auto update of fab migration versions --- .pre-commit-config.yaml | 4 +++- airflow/providers/fab/alembic.ini | 2 +- airflow/providers/fab/auth_manager/models/db.py | 2 +- ...older_migration.py => 0001_1_4_0_placeholder_migration.py} | 2 +- docs/apache-airflow-providers-fab/migrations-ref.rst | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) rename airflow/providers/fab/migrations/versions/{0001_1_3_0_placeholder_migration.py => 0001_1_4_0_placeholder_migration.py} (98%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a356de6dec21..4ca7f304d1e6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -510,7 +510,9 @@ repos: (?x) ^scripts/ci/pre_commit/version_heads_map\.py$| ^airflow/migrations/versions/.*$|^airflow/migrations/versions| - ^airflow/utils/db.py$ + ^airflow/providers/fab/migrations/versions/.*$|^airflow/providers/fab/migrations/versions| + ^airflow/utils/db.py$| + ^airflow/providers/fab/auth_manager/models/db.py$ additional_dependencies: ['packaging','google-re2'] - id: update-version name: Update versions in docs diff --git a/airflow/providers/fab/alembic.ini b/airflow/providers/fab/alembic.ini index 55c7338f9bd9..75d42ee16d3b 100644 --- a/airflow/providers/fab/alembic.ini +++ b/airflow/providers/fab/alembic.ini @@ -20,7 +20,7 @@ [alembic] # path to migration scripts # Use forward slashes (/) also on windows to provide an os agnostic path -script_location = migrations +script_location = %(here)s/migrations # template used to generate migration file names; The default value is %%(rev)s_%%(slug)s # Uncomment the line below if you want the files to be prepended with date and time diff --git a/airflow/providers/fab/auth_manager/models/db.py b/airflow/providers/fab/auth_manager/models/db.py index f72e1fcc65b8..efca4a104182 100644 --- a/airflow/providers/fab/auth_manager/models/db.py +++ b/airflow/providers/fab/auth_manager/models/db.py @@ -28,7 +28,7 @@ PACKAGE_DIR = os.path.dirname(airflow.__file__) _REVISION_HEADS_MAP: dict[str, str] = { - "1.3.0": "6709f7a774b9", + "1.4.0": "6709f7a774b9", } diff --git a/airflow/providers/fab/migrations/versions/0001_1_3_0_placeholder_migration.py b/airflow/providers/fab/migrations/versions/0001_1_4_0_placeholder_migration.py similarity index 98% rename from airflow/providers/fab/migrations/versions/0001_1_3_0_placeholder_migration.py rename to airflow/providers/fab/migrations/versions/0001_1_4_0_placeholder_migration.py index 685216779dcf..722c39198a18 100644 --- a/airflow/providers/fab/migrations/versions/0001_1_3_0_placeholder_migration.py +++ b/airflow/providers/fab/migrations/versions/0001_1_4_0_placeholder_migration.py @@ -36,7 +36,7 @@ down_revision = None branch_labels = None depends_on = None -fab_version = "1.3.0" +fab_version = "1.4.0" def upgrade() -> None: ... diff --git a/docs/apache-airflow-providers-fab/migrations-ref.rst b/docs/apache-airflow-providers-fab/migrations-ref.rst index dbddd6e7d413..bf27837e8479 100644 --- a/docs/apache-airflow-providers-fab/migrations-ref.rst +++ b/docs/apache-airflow-providers-fab/migrations-ref.rst @@ -34,7 +34,7 @@ Here's the list of all the Database Migrations that are executed via when you ru +-------------------------+--------------+---------------+------------------------+ | Revision ID | Revises ID | Fab Version | Description | +=========================+==============+===============+========================+ -| ``6709f7a774b9`` (head) | ``None`` | ``1.3.0`` | placeholder migration. | +| ``6709f7a774b9`` (head) | ``None`` | ``1.4.0`` | placeholder migration. | +-------------------------+--------------+---------------+------------------------+ .. End of auto-generated table