diff --git a/alembic/versions/2024_12_30_1816-172cdfb3e2ee_artifacts_index_workflow_run_block_id_.py b/alembic/versions/2024_12_30_1816-172cdfb3e2ee_artifacts_index_workflow_run_block_id_.py new file mode 100644 index 00000000..39dc3040 --- /dev/null +++ b/alembic/versions/2024_12_30_1816-172cdfb3e2ee_artifacts_index_workflow_run_block_id_.py @@ -0,0 +1,31 @@ +"""artifacts index - workflow run block id index + +Revision ID: 172cdfb3e2ee +Revises: d13af1e466fa +Create Date: 2024-12-30 18:16:04.102156+00:00 + +""" + +from typing import Sequence, Union + +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = "172cdfb3e2ee" +down_revision: Union[str, None] = "d13af1e466fa" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.create_index("org_observer_thought_index", "artifacts", ["organization_id", "observer_thought_id"], unique=False) + op.create_index("org_wfrb_index", "artifacts", ["organization_id", "workflow_run_block_id"], unique=False) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index("org_wfrb_index", table_name="artifacts") + op.drop_index("org_observer_thought_index", table_name="artifacts") + # ### end Alembic commands ### diff --git a/skyvern/forge/sdk/db/models.py b/skyvern/forge/sdk/db/models.py index 2966243f..7c1b0871 100644 --- a/skyvern/forge/sdk/db/models.py +++ b/skyvern/forge/sdk/db/models.py @@ -165,6 +165,8 @@ class ArtifactModel(Base): Index("org_task_step_index", "organization_id", "task_id", "step_id"), Index("org_workflow_run_index", "organization_id", "workflow_run_id"), Index("org_observer_cruise_index", "organization_id", "observer_cruise_id"), + Index("org_observer_thought_index", "organization_id", "observer_thought_id"), + Index("org_wfrb_index", "organization_id", "workflow_run_block_id"), ) artifact_id = Column(String, primary_key=True, index=True, default=generate_artifact_id)