workflow_run_block_id index for artifacts (#1450)

This commit is contained in:
Shuchang Zheng
2024-12-30 10:18:37 -08:00
committed by GitHub
parent 15ecec6d8d
commit 625af80b89
2 changed files with 33 additions and 0 deletions

View File

@@ -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 ###

View File

@@ -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)