Add workflow_oid_status_idx index to workflow table to index status (#1642)

This commit is contained in:
Shuchang Zheng
2025-01-25 04:17:12 +08:00
committed by GitHub
parent 4db5906d04
commit 0054117171
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
"""Add workflow_oid_status_idx index to workflow table to index status
Revision ID: 957ad2d1d3f7
Revises: 26dc22efaf0b
Create Date: 2025-01-24 20:14:49.790319+00:00
"""
from typing import Sequence, Union
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "957ad2d1d3f7"
down_revision: Union[str, None] = "26dc22efaf0b"
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("workflow_oid_status_idx", "workflows", ["organization_id", "status"], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index("workflow_oid_status_idx", table_name="workflows")
# ### end Alembic commands ###

View File

@@ -195,6 +195,7 @@ class WorkflowModel(Base):
),
Index("permanent_id_version_idx", "workflow_permanent_id", "version"),
Index("organization_id_title_idx", "organization_id", "title"),
Index("workflow_oid_status_idx", "organization_id", "status"),
)
workflow_id = Column(String, primary_key=True, index=True, default=generate_workflow_id)