From 1eb028807b5cdc4fe54a35a985d83655abc7c268 Mon Sep 17 00:00:00 2001 From: Orion Eiger Date: Mon, 16 Dec 2024 12:10:52 -0800 Subject: [PATCH] feat(db): Separate alembic versions into multiple files --- .../20428abf9581_error_tables_for_v0_4_0.py | 90 +++++++++++ ...93_separate_out_most_tables_and_indices.py | 95 +++++++++++ .../cacc1bb4152e_error_indices_for_v0_4_0.py | 29 ++++ ...d2a05fd9869c_script_template_for_v0_4_0.py | 33 ++++ .../f5e50e000a35_autogenerated_from_model.py | 150 ------------------ ...ea21_script_template_indices_for_v0_4_0.py | 25 +++ 6 files changed, 272 insertions(+), 150 deletions(-) create mode 100644 alembic/versions/20428abf9581_error_tables_for_v0_4_0.py create mode 100644 alembic/versions/92053b1ad093_separate_out_most_tables_and_indices.py create mode 100644 alembic/versions/cacc1bb4152e_error_indices_for_v0_4_0.py create mode 100644 alembic/versions/d2a05fd9869c_script_template_for_v0_4_0.py create mode 100644 alembic/versions/fb13f1f4ea21_script_template_indices_for_v0_4_0.py diff --git a/alembic/versions/20428abf9581_error_tables_for_v0_4_0.py b/alembic/versions/20428abf9581_error_tables_for_v0_4_0.py new file mode 100644 index 00000000..83ae44d1 --- /dev/null +++ b/alembic/versions/20428abf9581_error_tables_for_v0_4_0.py @@ -0,0 +1,90 @@ +"""Error tables for v0.4.0 + +Revision ID: 20428abf9581 +Revises: f5e50e000a35 +Create Date: 2024-12-13 22:07:55.828266+00:00 + +""" + +from collections.abc import Sequence + +import sqlalchemy as sa +from sqlalchemy import MetaData + +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = "20428abf9581" +down_revision: str | None = "f5e50e000a35" +branch_labels: str | Sequence[str] | None = None +depends_on: str | Sequence[str] | None = None + + +def upgrade() -> None: + # Create table for Pipetask Error Types + op.create_table( + "pipetask_error_type", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column( + "error_source", + sa.Enum( + "cmservice", + "local_script", + "manifest", + name="errorsourceenum", + create_type=False, + metadata=MetaData(), + ), + nullable=False, + ), + sa.Column( + "error_flavor", + sa.Enum( + "infrastructure", + "configuration", + "pipelines", + name="errorflavorenum", + create_type=False, + metadata=MetaData(), + ), + nullable=False, + ), + sa.Column( + "error_action", + sa.Enum( + "fail", + "requeue_and_pause", + "rescue", + "auto_retry", + "review", + "accept", + name="erroractionenum", + create_type=False, + metadata=MetaData(), + ), + nullable=False, + ), + sa.Column("task_name", sa.String(), nullable=False), + sa.Column("diagnostic_message", sa.String(), nullable=False), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("task_name", "diagnostic_message"), + ) + # Create table for Pipetask Errors + op.create_table( + "pipetask_error", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("error_type_id", sa.Integer(), nullable=True), + sa.Column("task_id", sa.Integer(), nullable=False), + sa.Column("quanta", sa.String(), nullable=False), + sa.Column("diagnostic_message", sa.String(), nullable=False), + sa.Column("data_id", sa.JSON(), nullable=True), + sa.ForeignKeyConstraint(["error_type_id"], ["pipetask_error_type.id"], ondelete="CASCADE"), + sa.ForeignKeyConstraint(["task_id"], ["task_set.id"], ondelete="CASCADE"), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("quanta"), + ) + + +def downgrade() -> None: + op.drop_table("pipetask_error") + op.drop_table("pipetask_error_type") diff --git a/alembic/versions/92053b1ad093_separate_out_most_tables_and_indices.py b/alembic/versions/92053b1ad093_separate_out_most_tables_and_indices.py new file mode 100644 index 00000000..31151d9e --- /dev/null +++ b/alembic/versions/92053b1ad093_separate_out_most_tables_and_indices.py @@ -0,0 +1,95 @@ +"""Separate out most tables and indices + +Revision ID: 92053b1ad093 +Revises: d2a05fd9869c +Create Date: 2024-12-16 20:45:33.619155+00:00 + +""" + +from collections.abc import Sequence + +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = "92053b1ad093" +down_revision: str | None = "d2a05fd9869c" +branch_labels: str | Sequence[str] | None = None +depends_on: str | Sequence[str] | None = None + + +def upgrade() -> None: + op.create_index(op.f("ix_production_name"), "production", ["name"], unique=True) + op.create_index(op.f("ix_spec_block_name"), "spec_block", ["name"], unique=False) + op.create_index(op.f("ix_specification_name"), "specification", ["name"], unique=False) + op.create_index(op.f("ix_campaign_name"), "campaign", ["name"], unique=False) + op.create_index(op.f("ix_campaign_parent_id"), "campaign", ["parent_id"], unique=False) + op.create_index(op.f("ix_campaign_spec_block_id"), "campaign", ["spec_block_id"], unique=False) + op.create_index(op.f("ix_campaign_spec_id"), "campaign", ["spec_id"], unique=False) + op.create_index(op.f("ix_step_name"), "step", ["name"], unique=False) + op.create_index(op.f("ix_step_parent_id"), "step", ["parent_id"], unique=False) + op.create_index(op.f("ix_step_spec_block_id"), "step", ["spec_block_id"], unique=False) + op.create_index(op.f("ix_group_name"), "group", ["name"], unique=False) + op.create_index(op.f("ix_group_parent_id"), "group", ["parent_id"], unique=False) + op.create_index(op.f("ix_group_spec_block_id"), "group", ["spec_block_id"], unique=False) + op.create_index(op.f("ix_step_dependency_depend_id"), "step_dependency", ["depend_id"], unique=False) + op.create_index(op.f("ix_step_dependency_prereq_id"), "step_dependency", ["prereq_id"], unique=False) + op.create_index(op.f("ix_job_name"), "job", ["name"], unique=False) + op.create_index(op.f("ix_job_parent_id"), "job", ["parent_id"], unique=False) + op.create_index(op.f("ix_job_spec_block_id"), "job", ["spec_block_id"], unique=False) + op.create_index(op.f("ix_script_c_id"), "script", ["c_id"], unique=False) + op.create_index(op.f("ix_script_g_id"), "script", ["g_id"], unique=False) + op.create_index(op.f("ix_script_j_id"), "script", ["j_id"], unique=False) + op.create_index(op.f("ix_script_name"), "script", ["name"], unique=False) + op.create_index(op.f("ix_script_s_id"), "script", ["s_id"], unique=False) + op.create_index(op.f("ix_script_spec_block_id"), "script", ["spec_block_id"], unique=False) + op.create_index(op.f("ix_task_set_job_id"), "task_set", ["job_id"], unique=False) + op.create_index(op.f("ix_wms_task_report_job_id"), "wms_task_report", ["job_id"], unique=False) + op.create_index(op.f("ix_product_set_job_id"), "product_set", ["job_id"], unique=False) + op.create_index(op.f("ix_product_set_task_id"), "product_set", ["task_id"], unique=False) + op.create_index(op.f("ix_queue_c_id"), "queue", ["c_id"], unique=False) + op.create_index(op.f("ix_queue_g_id"), "queue", ["g_id"], unique=False) + op.create_index(op.f("ix_queue_j_id"), "queue", ["j_id"], unique=False) + op.create_index(op.f("ix_queue_s_id"), "queue", ["s_id"], unique=False) + op.create_index(op.f("ix_queue_script_id"), "queue", ["script_id"], unique=False) + op.create_index(op.f("ix_script_dependency_depend_id"), "script_dependency", ["depend_id"], unique=False) + op.create_index(op.f("ix_script_dependency_prereq_id"), "script_dependency", ["prereq_id"], unique=False) + op.create_index(op.f("ix_script_error_script_id"), "script_error", ["script_id"], unique=False) + + +def downgrade() -> None: + op.drop_index(op.f("ix_script_error_script_id"), table_name="script_error") + op.drop_index(op.f("ix_script_dependency_prereq_id"), table_name="script_dependency") + op.drop_index(op.f("ix_script_dependency_depend_id"), table_name="script_dependency") + op.drop_index(op.f("ix_queue_script_id"), table_name="queue") + op.drop_index(op.f("ix_queue_s_id"), table_name="queue") + op.drop_index(op.f("ix_queue_j_id"), table_name="queue") + op.drop_index(op.f("ix_queue_g_id"), table_name="queue") + op.drop_index(op.f("ix_queue_c_id"), table_name="queue") + op.drop_index(op.f("ix_product_set_task_id"), table_name="product_set") + op.drop_index(op.f("ix_product_set_job_id"), table_name="product_set") + op.drop_index(op.f("ix_wms_task_report_job_id"), table_name="wms_task_report") + op.drop_index(op.f("ix_task_set_job_id"), table_name="task_set") + op.drop_index(op.f("ix_script_spec_block_id"), table_name="script") + op.drop_index(op.f("ix_script_s_id"), table_name="script") + op.drop_index(op.f("ix_script_name"), table_name="script") + op.drop_index(op.f("ix_script_j_id"), table_name="script") + op.drop_index(op.f("ix_script_g_id"), table_name="script") + op.drop_index(op.f("ix_script_c_id"), table_name="script") + op.drop_index(op.f("ix_job_spec_block_id"), table_name="job") + op.drop_index(op.f("ix_job_parent_id"), table_name="job") + op.drop_index(op.f("ix_job_name"), table_name="job") + op.drop_index(op.f("ix_step_dependency_prereq_id"), table_name="step_dependency") + op.drop_index(op.f("ix_step_dependency_depend_id"), table_name="step_dependency") + op.drop_index(op.f("ix_group_spec_block_id"), table_name="group") + op.drop_index(op.f("ix_group_parent_id"), table_name="group") + op.drop_index(op.f("ix_group_name"), table_name="group") + op.drop_index(op.f("ix_step_spec_block_id"), table_name="step") + op.drop_index(op.f("ix_step_parent_id"), table_name="step") + op.drop_index(op.f("ix_step_name"), table_name="step") + op.drop_index(op.f("ix_campaign_spec_id"), table_name="campaign") + op.drop_index(op.f("ix_campaign_spec_block_id"), table_name="campaign") + op.drop_index(op.f("ix_campaign_parent_id"), table_name="campaign") + op.drop_index(op.f("ix_campaign_name"), table_name="campaign") + op.drop_index(op.f("ix_specification_name"), table_name="specification") + op.drop_index(op.f("ix_spec_block_name"), table_name="spec_block") + op.drop_index(op.f("ix_production_name"), table_name="production") diff --git a/alembic/versions/cacc1bb4152e_error_indices_for_v0_4_0.py b/alembic/versions/cacc1bb4152e_error_indices_for_v0_4_0.py new file mode 100644 index 00000000..d72c619f --- /dev/null +++ b/alembic/versions/cacc1bb4152e_error_indices_for_v0_4_0.py @@ -0,0 +1,29 @@ +"""Error indices for v0.4.0 + +Revision ID: cacc1bb4152e +Revises: 92053b1ad093 +Create Date: 2024-12-16 21:10:24.132473+00:00 + +""" + +from collections.abc import Sequence + +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = "cacc1bb4152e" +down_revision: str | None = "92053b1ad093" +branch_labels: str | Sequence[str] | None = None +depends_on: str | Sequence[str] | None = None + + +def upgrade() -> None: + op.create_index( + op.f("ix_pipetask_error_error_type_id"), "pipetask_error", ["error_type_id"], unique=False + ) + op.create_index(op.f("ix_pipetask_error_task_id"), "pipetask_error", ["task_id"], unique=False) + + +def downgrade() -> None: + op.drop_index(op.f("ix_pipetask_error_task_id"), table_name="pipetask_error") + op.drop_index(op.f("ix_pipetask_error_error_type_id"), table_name="pipetask_error") diff --git a/alembic/versions/d2a05fd9869c_script_template_for_v0_4_0.py b/alembic/versions/d2a05fd9869c_script_template_for_v0_4_0.py new file mode 100644 index 00000000..173c0df2 --- /dev/null +++ b/alembic/versions/d2a05fd9869c_script_template_for_v0_4_0.py @@ -0,0 +1,33 @@ +"""Script template for v0.4.0 + +Revision ID: d2a05fd9869c +Revises: 20428abf9581 +Create Date: 2024-12-16 20:24:15.129144+00:00 + +""" + +from collections.abc import Sequence + +import sqlalchemy as sa + +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = "d2a05fd9869c" +down_revision: str | None = "20428abf9581" +branch_labels: str | Sequence[str] | None = None +depends_on: str | Sequence[str] | None = None + + +def upgrade() -> None: + op.create_table( + "script_template", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("name", sa.String(), nullable=False), + sa.Column("data", sa.JSON(), nullable=True), + sa.PrimaryKeyConstraint("id"), + ) + + +def downgrade() -> None: + op.drop_table("script_template") diff --git a/alembic/versions/f5e50e000a35_autogenerated_from_model.py b/alembic/versions/f5e50e000a35_autogenerated_from_model.py index 6ab67e52..0149fc87 100644 --- a/alembic/versions/f5e50e000a35_autogenerated_from_model.py +++ b/alembic/versions/f5e50e000a35_autogenerated_from_model.py @@ -29,68 +29,12 @@ def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "pipetask_error_type", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column( - "error_source", - sa.Enum( - "cmservice", - "local_script", - "manifest", - name="errorsourceenum", - create_type=False, - metadata=MetaData(), - ), - nullable=False, - ), - sa.Column( - "error_flavor", - sa.Enum( - "infrastructure", - "configuration", - "pipelines", - name="errorflavorenum", - create_type=False, - metadata=MetaData(), - ), - nullable=False, - ), - sa.Column( - "error_action", - sa.Enum( - "fail", - "requeue_and_pause", - "rescue", - "auto_retry", - "review", - "accept", - name="erroractionenum", - create_type=False, - metadata=MetaData(), - ), - nullable=False, - ), - sa.Column("task_name", sa.String(), nullable=False), - sa.Column("diagnostic_message", sa.String(), nullable=False), - sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint("task_name", "diagnostic_message"), - ) op.create_table( "production", sa.Column("id", sa.Integer(), nullable=False), sa.Column("name", sa.String(), nullable=False), sa.PrimaryKeyConstraint("id"), ) - op.create_index(op.f("ix_production_name"), "production", ["name"], unique=True) - op.create_table( - "script_template", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("name", sa.String(), nullable=False), - sa.Column("data", sa.JSON(), nullable=True), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_script_template_name"), "script_template", ["name"], unique=False) op.create_table( "spec_block", sa.Column("id", sa.Integer(), nullable=False), @@ -104,7 +48,6 @@ def upgrade() -> None: sa.Column("steps", sa.JSON(), nullable=True), sa.PrimaryKeyConstraint("id"), ) - op.create_index(op.f("ix_spec_block_name"), "spec_block", ["name"], unique=False) op.create_table( "specification", sa.Column("id", sa.Integer(), nullable=False), @@ -115,7 +58,6 @@ def upgrade() -> None: sa.Column("spec_aliases", sa.JSON(), nullable=True), sa.PrimaryKeyConstraint("id"), ) - op.create_index(op.f("ix_specification_name"), "specification", ["name"], unique=False) op.create_table( "campaign", sa.Column("id", sa.Integer(), nullable=False), @@ -157,10 +99,6 @@ def upgrade() -> None: sa.UniqueConstraint("fullname"), sa.UniqueConstraint("parent_id", "name"), ) - op.create_index(op.f("ix_campaign_name"), "campaign", ["name"], unique=False) - op.create_index(op.f("ix_campaign_parent_id"), "campaign", ["parent_id"], unique=False) - op.create_index(op.f("ix_campaign_spec_block_id"), "campaign", ["spec_block_id"], unique=False) - op.create_index(op.f("ix_campaign_spec_id"), "campaign", ["spec_id"], unique=False) op.create_table( "step", sa.Column("id", sa.Integer(), nullable=False), @@ -200,9 +138,6 @@ def upgrade() -> None: sa.UniqueConstraint("fullname"), sa.UniqueConstraint("parent_id", "name"), ) - op.create_index(op.f("ix_step_name"), "step", ["name"], unique=False) - op.create_index(op.f("ix_step_parent_id"), "step", ["parent_id"], unique=False) - op.create_index(op.f("ix_step_spec_block_id"), "step", ["spec_block_id"], unique=False) op.create_table( "group", sa.Column("id", sa.Integer(), nullable=False), @@ -242,9 +177,6 @@ def upgrade() -> None: sa.UniqueConstraint("fullname"), sa.UniqueConstraint("parent_id", "name"), ) - op.create_index(op.f("ix_group_name"), "group", ["name"], unique=False) - op.create_index(op.f("ix_group_parent_id"), "group", ["parent_id"], unique=False) - op.create_index(op.f("ix_group_spec_block_id"), "group", ["spec_block_id"], unique=False) op.create_table( "step_dependency", sa.Column("id", sa.Integer(), nullable=False), @@ -254,8 +186,6 @@ def upgrade() -> None: sa.ForeignKeyConstraint(["prereq_id"], ["step.id"], ondelete="CASCADE"), sa.PrimaryKeyConstraint("id"), ) - op.create_index(op.f("ix_step_dependency_depend_id"), "step_dependency", ["depend_id"], unique=False) - op.create_index(op.f("ix_step_dependency_prereq_id"), "step_dependency", ["prereq_id"], unique=False) op.create_table( "job", sa.Column("id", sa.Integer(), nullable=False), @@ -297,9 +227,6 @@ def upgrade() -> None: sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("fullname"), ) - op.create_index(op.f("ix_job_name"), "job", ["name"], unique=False) - op.create_index(op.f("ix_job_parent_id"), "job", ["parent_id"], unique=False) - op.create_index(op.f("ix_job_spec_block_id"), "job", ["spec_block_id"], unique=False) op.create_table( "script", sa.Column("id", sa.Integer(), nullable=False), @@ -378,12 +305,6 @@ def upgrade() -> None: sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("fullname"), ) - op.create_index(op.f("ix_script_c_id"), "script", ["c_id"], unique=False) - op.create_index(op.f("ix_script_g_id"), "script", ["g_id"], unique=False) - op.create_index(op.f("ix_script_j_id"), "script", ["j_id"], unique=False) - op.create_index(op.f("ix_script_name"), "script", ["name"], unique=False) - op.create_index(op.f("ix_script_s_id"), "script", ["s_id"], unique=False) - op.create_index(op.f("ix_script_spec_block_id"), "script", ["spec_block_id"], unique=False) op.create_table( "task_set", sa.Column("id", sa.Integer(), nullable=False), @@ -398,7 +319,6 @@ def upgrade() -> None: sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("fullname"), ) - op.create_index(op.f("ix_task_set_job_id"), "task_set", ["job_id"], unique=False) op.create_table( "wms_task_report", sa.Column("id", sa.Integer(), nullable=False), @@ -420,24 +340,6 @@ def upgrade() -> None: sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("fullname"), ) - op.create_index(op.f("ix_wms_task_report_job_id"), "wms_task_report", ["job_id"], unique=False) - op.create_table( - "pipetask_error", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("error_type_id", sa.Integer(), nullable=True), - sa.Column("task_id", sa.Integer(), nullable=False), - sa.Column("quanta", sa.String(), nullable=False), - sa.Column("diagnostic_message", sa.String(), nullable=False), - sa.Column("data_id", sa.JSON(), nullable=True), - sa.ForeignKeyConstraint(["error_type_id"], ["pipetask_error_type.id"], ondelete="CASCADE"), - sa.ForeignKeyConstraint(["task_id"], ["task_set.id"], ondelete="CASCADE"), - sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint("quanta"), - ) - op.create_index( - op.f("ix_pipetask_error_error_type_id"), "pipetask_error", ["error_type_id"], unique=False - ) - op.create_index(op.f("ix_pipetask_error_task_id"), "pipetask_error", ["task_id"], unique=False) op.create_table( "product_set", sa.Column("id", sa.Integer(), nullable=False), @@ -455,8 +357,6 @@ def upgrade() -> None: sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("fullname"), ) - op.create_index(op.f("ix_product_set_job_id"), "product_set", ["job_id"], unique=False) - op.create_index(op.f("ix_product_set_task_id"), "product_set", ["task_id"], unique=False) op.create_table( "queue", sa.Column("id", sa.Integer(), nullable=False), @@ -495,11 +395,6 @@ def upgrade() -> None: sa.ForeignKeyConstraint(["script_id"], ["script.id"], ondelete="CASCADE"), sa.PrimaryKeyConstraint("id"), ) - op.create_index(op.f("ix_queue_c_id"), "queue", ["c_id"], unique=False) - op.create_index(op.f("ix_queue_g_id"), "queue", ["g_id"], unique=False) - op.create_index(op.f("ix_queue_j_id"), "queue", ["j_id"], unique=False) - op.create_index(op.f("ix_queue_s_id"), "queue", ["s_id"], unique=False) - op.create_index(op.f("ix_queue_script_id"), "queue", ["script_id"], unique=False) op.create_table( "script_dependency", sa.Column("id", sa.Integer(), nullable=False), @@ -509,8 +404,6 @@ def upgrade() -> None: sa.ForeignKeyConstraint(["prereq_id"], ["script.id"], ondelete="CASCADE"), sa.PrimaryKeyConstraint("id"), ) - op.create_index(op.f("ix_script_dependency_depend_id"), "script_dependency", ["depend_id"], unique=False) - op.create_index(op.f("ix_script_dependency_prereq_id"), "script_dependency", ["prereq_id"], unique=False) op.create_table( "script_error", sa.Column("id", sa.Integer(), nullable=False), @@ -531,67 +424,24 @@ def upgrade() -> None: sa.ForeignKeyConstraint(["script_id"], ["script.id"], ondelete="CASCADE"), sa.PrimaryKeyConstraint("id"), ) - op.create_index(op.f("ix_script_error_script_id"), "script_error", ["script_id"], unique=False) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_script_error_script_id"), table_name="script_error") op.drop_table("script_error") - op.drop_index(op.f("ix_script_dependency_prereq_id"), table_name="script_dependency") - op.drop_index(op.f("ix_script_dependency_depend_id"), table_name="script_dependency") op.drop_table("script_dependency") - op.drop_index(op.f("ix_queue_script_id"), table_name="queue") - op.drop_index(op.f("ix_queue_s_id"), table_name="queue") - op.drop_index(op.f("ix_queue_j_id"), table_name="queue") - op.drop_index(op.f("ix_queue_g_id"), table_name="queue") - op.drop_index(op.f("ix_queue_c_id"), table_name="queue") op.drop_table("queue") - op.drop_index(op.f("ix_product_set_task_id"), table_name="product_set") - op.drop_index(op.f("ix_product_set_job_id"), table_name="product_set") op.drop_table("product_set") - op.drop_index(op.f("ix_pipetask_error_task_id"), table_name="pipetask_error") - op.drop_index(op.f("ix_pipetask_error_error_type_id"), table_name="pipetask_error") - op.drop_table("pipetask_error") - op.drop_index(op.f("ix_wms_task_report_job_id"), table_name="wms_task_report") op.drop_table("wms_task_report") - op.drop_index(op.f("ix_task_set_job_id"), table_name="task_set") op.drop_table("task_set") - op.drop_index(op.f("ix_script_spec_block_id"), table_name="script") - op.drop_index(op.f("ix_script_s_id"), table_name="script") - op.drop_index(op.f("ix_script_name"), table_name="script") - op.drop_index(op.f("ix_script_j_id"), table_name="script") - op.drop_index(op.f("ix_script_g_id"), table_name="script") - op.drop_index(op.f("ix_script_c_id"), table_name="script") op.drop_table("script") - op.drop_index(op.f("ix_job_spec_block_id"), table_name="job") - op.drop_index(op.f("ix_job_parent_id"), table_name="job") - op.drop_index(op.f("ix_job_name"), table_name="job") op.drop_table("job") - op.drop_index(op.f("ix_step_dependency_prereq_id"), table_name="step_dependency") - op.drop_index(op.f("ix_step_dependency_depend_id"), table_name="step_dependency") op.drop_table("step_dependency") - op.drop_index(op.f("ix_group_spec_block_id"), table_name="group") - op.drop_index(op.f("ix_group_parent_id"), table_name="group") - op.drop_index(op.f("ix_group_name"), table_name="group") op.drop_table("group") - op.drop_index(op.f("ix_step_spec_block_id"), table_name="step") - op.drop_index(op.f("ix_step_parent_id"), table_name="step") - op.drop_index(op.f("ix_step_name"), table_name="step") op.drop_table("step") - op.drop_index(op.f("ix_campaign_spec_id"), table_name="campaign") - op.drop_index(op.f("ix_campaign_spec_block_id"), table_name="campaign") - op.drop_index(op.f("ix_campaign_parent_id"), table_name="campaign") - op.drop_index(op.f("ix_campaign_name"), table_name="campaign") op.drop_table("campaign") - op.drop_index(op.f("ix_specification_name"), table_name="specification") op.drop_table("specification") - op.drop_index(op.f("ix_spec_block_name"), table_name="spec_block") op.drop_table("spec_block") - op.drop_index(op.f("ix_script_template_name"), table_name="script_template") - op.drop_table("script_template") - op.drop_index(op.f("ix_production_name"), table_name="production") op.drop_table("production") - op.drop_table("pipetask_error_type") # ### end Alembic commands ### diff --git a/alembic/versions/fb13f1f4ea21_script_template_indices_for_v0_4_0.py b/alembic/versions/fb13f1f4ea21_script_template_indices_for_v0_4_0.py new file mode 100644 index 00000000..872ea14d --- /dev/null +++ b/alembic/versions/fb13f1f4ea21_script_template_indices_for_v0_4_0.py @@ -0,0 +1,25 @@ +"""Script template indices for v0.4.0 + +Revision ID: fb13f1f4ea21 +Revises: cacc1bb4152e +Create Date: 2024-12-16 21:14:03.584656+00:00 + +""" + +from collections.abc import Sequence + +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = "fb13f1f4ea21" +down_revision: str | None = "cacc1bb4152e" +branch_labels: str | Sequence[str] | None = None +depends_on: str | Sequence[str] | None = None + + +def upgrade() -> None: + op.create_index(op.f("ix_script_template_name"), "script_template", ["name"], unique=False) + + +def downgrade() -> None: + op.drop_index(op.f("ix_script_template_name"), table_name="script_template")