Add tasks.workflow_run_id index (#946)

This commit is contained in:
Kerem Yilmaz
2024-10-09 09:55:47 -07:00
committed by GitHub
parent 202fad8d9b
commit 6cf20221e6
2 changed files with 30 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
"""Add workflow_run_id index to tasks
Revision ID: 12fb2dede685
Revises: a575628e1965
Create Date: 2024-10-09 16:52:36.095562+00:00
"""
from typing import Sequence, Union
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "12fb2dede685"
down_revision: Union[str, None] = "a575628e1965"
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(op.f("ix_tasks_workflow_run_id"), "tasks", ["workflow_run_id"], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_tasks_workflow_run_id"), table_name="tasks")
# ### end Alembic commands ###

View File

@@ -61,7 +61,7 @@ class TaskModel(Base):
failure_reason = Column(String)
proxy_location = Column(Enum(ProxyLocation))
extracted_information_schema = Column(JSON)
workflow_run_id = Column(String, ForeignKey("workflow_runs.workflow_run_id"))
workflow_run_id = Column(String, ForeignKey("workflow_runs.workflow_run_id"), index=True)
order = Column(Integer, nullable=True)
retry = Column(Integer, nullable=True)
error_code_mapping = Column(JSON, nullable=True)