This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 92ffab6004 Remove unused index `idx_last_scheduling_decision` on 
`dag_run` table (#39275)
92ffab6004 is described below

commit 92ffab60049723a4a82fce7f256892fcd6a980d5
Author: Pankaj Koti <[email protected]>
AuthorDate: Wed May 1 01:27:41 2024 +0530

    Remove unused index `idx_last_scheduling_decision` on `dag_run` table 
(#39275)
---
 ..._2_9_2_remove_idx_last_scheduling_decision_.py} | 24 +++++++++++-----------
 ...=> 0142_2_10_0_add_new_executor_field_to_db.py} |  6 +++---
 airflow/models/dagrun.py                           |  1 -
 airflow/utils/db.py                                |  2 ++
 docs/apache-airflow/img/airflow_erd.sha256         |  2 +-
 docs/apache-airflow/migrations-ref.rst             |  5 ++++-
 6 files changed, 22 insertions(+), 18 deletions(-)

diff --git 
a/airflow/migrations/versions/0141_2_10_0_add_new_executor_field_to_db.py 
b/airflow/migrations/versions/0141_2_9_2_remove_idx_last_scheduling_decision_.py
similarity index 58%
copy from 
airflow/migrations/versions/0141_2_10_0_add_new_executor_field_to_db.py
copy to 
airflow/migrations/versions/0141_2_9_2_remove_idx_last_scheduling_decision_.py
index 67e463f1cc..70923a4780 100644
--- a/airflow/migrations/versions/0141_2_10_0_add_new_executor_field_to_db.py
+++ 
b/airflow/migrations/versions/0141_2_9_2_remove_idx_last_scheduling_decision_.py
@@ -16,31 +16,31 @@
 # specific language governing permissions and limitations
 # under the License.
 
-"""add new executor field to db
+"""Remove ``idx_last_scheduling_decision`` index on last_scheduling_decision 
in dag_run table
 
-Revision ID: 677fdbb7fc54
-Revises: 1949afb29106
-Create Date: 2024-04-01 15:26:59.186579
+Revision ID: bff083ad727d
+Revises: 677fdbb7fc54
+Create Date: 2024-04-26 12:58:00.594762
 
 """
 
-import sqlalchemy as sa
 from alembic import op
 
 
 # revision identifiers, used by Alembic.
-revision = '677fdbb7fc54'
-down_revision = '1949afb29106'
+revision = "bff083ad727d"
+down_revision = "1949afb29106"
 branch_labels = None
 depends_on = None
-airflow_version = '2.10.0'
+airflow_version = "2.9.2"
 
 
 def upgrade():
-    """Apply add executor field to task instance"""
-    op.add_column('task_instance', sa.Column('executor', 
sa.String(length=1000), default=None))
+    """Apply Remove idx_last_scheduling_decision index on 
last_scheduling_decision in dag_run table"""
+    op.drop_index("idx_last_scheduling_decision", table_name="dag_run")
 
 
 def downgrade():
-    """Unapply add executor field to task instance"""
-    op.drop_column('task_instance', 'executor')
+    """Unapply Remove idx_last_scheduling_decision index on 
last_scheduling_decision in dag_run table"""
+    op.create_index("idx_last_scheduling_decision", "dag_run", 
["last_scheduling_decision"],
+                    unique=False)
diff --git 
a/airflow/migrations/versions/0141_2_10_0_add_new_executor_field_to_db.py 
b/airflow/migrations/versions/0142_2_10_0_add_new_executor_field_to_db.py
similarity index 94%
rename from 
airflow/migrations/versions/0141_2_10_0_add_new_executor_field_to_db.py
rename to 
airflow/migrations/versions/0142_2_10_0_add_new_executor_field_to_db.py
index 67e463f1cc..0a6b64460e 100644
--- a/airflow/migrations/versions/0141_2_10_0_add_new_executor_field_to_db.py
+++ b/airflow/migrations/versions/0142_2_10_0_add_new_executor_field_to_db.py
@@ -29,11 +29,11 @@ from alembic import op
 
 
 # revision identifiers, used by Alembic.
-revision = '677fdbb7fc54'
-down_revision = '1949afb29106'
+revision = "677fdbb7fc54"
+down_revision = "bff083ad727d"
 branch_labels = None
 depends_on = None
-airflow_version = '2.10.0'
+airflow_version = "2.10.0"
 
 
 def upgrade():
diff --git a/airflow/models/dagrun.py b/airflow/models/dagrun.py
index 774f8d0983..77679f8d9a 100644
--- a/airflow/models/dagrun.py
+++ b/airflow/models/dagrun.py
@@ -159,7 +159,6 @@ class DagRun(Base, LoggingMixin):
         Index("dag_id_state", dag_id, _state),
         UniqueConstraint("dag_id", "execution_date", 
name="dag_run_dag_id_execution_date_key"),
         UniqueConstraint("dag_id", "run_id", name="dag_run_dag_id_run_id_key"),
-        Index("idx_last_scheduling_decision", last_scheduling_decision),
         Index("idx_dag_run_dag_id", dag_id),
         Index(
             "idx_dag_run_running_dags",
diff --git a/airflow/utils/db.py b/airflow/utils/db.py
index b7997498bb..af53c241ed 100644
--- a/airflow/utils/db.py
+++ b/airflow/utils/db.py
@@ -91,6 +91,8 @@ _REVISION_HEADS_MAP = {
     "2.8.0": "10b52ebd31f7",
     "2.8.1": "88344c1d9134",
     "2.9.0": "1949afb29106",
+    "2.9.2": "bff083ad727d",
+    "2.10.0": "677fdbb7fc54",
 }
 
 
diff --git a/docs/apache-airflow/img/airflow_erd.sha256 
b/docs/apache-airflow/img/airflow_erd.sha256
index cdcf039446..bc62123137 100644
--- a/docs/apache-airflow/img/airflow_erd.sha256
+++ b/docs/apache-airflow/img/airflow_erd.sha256
@@ -1 +1 @@
-77757e21aee500cb7fe7fd75e0f158633a0037d4d74e6f45eb14238f901ebacd
\ No newline at end of file
+955a39c49c73c0ef63d55f428840c915438df4fd13abb5bfa2bd9cfe5f7c22ae
\ No newline at end of file
diff --git a/docs/apache-airflow/migrations-ref.rst 
b/docs/apache-airflow/migrations-ref.rst
index d858879d54..14b22daee2 100644
--- a/docs/apache-airflow/migrations-ref.rst
+++ b/docs/apache-airflow/migrations-ref.rst
@@ -39,7 +39,10 @@ Here's the list of all the Database Migrations that are 
executed via when you ru
 
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
 | Revision ID                     | Revises ID        | Airflow Version   | 
Description                                                  |
 
+=================================+===================+===================+==============================================================+
-| ``677fdbb7fc54`` (head)         | ``1949afb29106``  | ``2.10.0``        | 
add new executor field to db                                 |
+| ``677fdbb7fc54`` (head)         | ``bff083ad727d``  | ``2.10.0``        | 
add new executor field to db                                 |
++---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
+| ``bff083ad727d``                | ``1949afb29106``  | ``2.9.2``         | 
Remove ``idx_last_scheduling_decision`` index on             |
+|                                 |                   |                   | 
last_scheduling_decision in dag_run table                    |
 
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
 | ``1949afb29106``                | ``ee1467d4aa35``  | ``2.9.0``         | 
update trigger kwargs type and encrypt                       |
 
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+

Reply via email to