add artifacts_org_created_at_index for artifacts table (#2755)
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
"""add index for artifacts table (organization_id, created_at)
|
||||||
|
|
||||||
|
Revision ID: afeed80576cb
|
||||||
|
Revises: 2d2f165170f1
|
||||||
|
Create Date: 2025-06-19 22:59:31.436342+00:00
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = "afeed80576cb"
|
||||||
|
down_revision: Union[str, None] = "2d2f165170f1"
|
||||||
|
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("artifacts_org_created_at_index", "artifacts", ["organization_id", "created_at"], unique=False)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_index("artifacts_org_created_at_index", table_name="artifacts")
|
||||||
|
# ### end Alembic commands ###
|
||||||
@@ -177,7 +177,10 @@ class OrganizationAuthTokenModel(Base):
|
|||||||
|
|
||||||
class ArtifactModel(Base):
|
class ArtifactModel(Base):
|
||||||
__tablename__ = "artifacts"
|
__tablename__ = "artifacts"
|
||||||
__table_args__ = (Index("org_task_step_index", "organization_id", "task_id", "step_id"),)
|
__table_args__ = (
|
||||||
|
Index("org_task_step_index", "organization_id", "task_id", "step_id"),
|
||||||
|
Index("artifacts_org_created_at_index", "organization_id", "created_at"),
|
||||||
|
)
|
||||||
|
|
||||||
artifact_id = Column(String, primary_key=True, default=generate_artifact_id)
|
artifact_id = Column(String, primary_key=True, default=generate_artifact_id)
|
||||||
organization_id = Column(String, ForeignKey("organizations.organization_id"))
|
organization_id = Column(String, ForeignKey("organizations.organization_id"))
|
||||||
|
|||||||
Reference in New Issue
Block a user