add step_id index to artifacts table (#615)

Co-authored-by: Shuchang Zheng <wintonzheng0325@gmail.com>
This commit is contained in:
Kerem Yilmaz
2024-07-17 15:30:41 -07:00
committed by GitHub
parent 5480e00545
commit 64f565cb7c
2 changed files with 30 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
"""add step_id index to artifacts table
Revision ID: 94bc3829eed6
Revises: 370cb81c73e7
Create Date: 2024-07-17 22:27:30.734057+00:00
"""
from typing import Sequence, Union
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "94bc3829eed6"
down_revision: Union[str, None] = "370cb81c73e7"
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_artifacts_step_id"), "artifacts", ["step_id"], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_artifacts_step_id"), table_name="artifacts")
# ### end Alembic commands ###

View File

@@ -148,7 +148,7 @@ class ArtifactModel(Base):
artifact_id = Column(String, primary_key=True, index=True, default=generate_artifact_id)
organization_id = Column(String, ForeignKey("organizations.organization_id"))
task_id = Column(String, ForeignKey("tasks.task_id"))
step_id = Column(String, ForeignKey("steps.step_id"))
step_id = Column(String, ForeignKey("steps.step_id"), index=True)
artifact_type = Column(String)
uri = Column(String)
created_at = Column(DateTime, default=datetime.datetime.utcnow, nullable=False)