mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-04-28 03:30:10 +00:00
create partial index alembic migrations (#5003)
This commit is contained in:
parent
e3cc810c24
commit
5cc73fcbce
3 changed files with 94 additions and 0 deletions
|
|
@ -0,0 +1,73 @@
|
|||
"""partial index for artifacts table
|
||||
|
||||
Revision ID: 08f585f2e7a6
|
||||
Revises: a86c9fdba6b3
|
||||
Create Date: 2026-03-06 18:04:47.414053+00:00
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "08f585f2e7a6"
|
||||
down_revision: Union[str, None] = "a86c9fdba6b3"
|
||||
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(
|
||||
"ix_artifacts_observer_cruise_id_partial",
|
||||
"artifacts",
|
||||
["observer_cruise_id"],
|
||||
unique=False,
|
||||
postgresql_where=sa.text("observer_cruise_id IS NOT NULL"),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_artifacts_observer_thought_id_partial",
|
||||
"artifacts",
|
||||
["observer_thought_id"],
|
||||
unique=False,
|
||||
postgresql_where=sa.text("observer_thought_id IS NOT NULL"),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_artifacts_run_id_partial",
|
||||
"artifacts",
|
||||
["run_id"],
|
||||
unique=False,
|
||||
postgresql_where=sa.text("run_id IS NOT NULL"),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_artifacts_workflow_run_block_id_partial",
|
||||
"artifacts",
|
||||
["workflow_run_block_id"],
|
||||
unique=False,
|
||||
postgresql_where=sa.text("workflow_run_block_id IS NOT NULL"),
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(
|
||||
"ix_artifacts_workflow_run_block_id_partial",
|
||||
table_name="artifacts",
|
||||
postgresql_where=sa.text("workflow_run_block_id IS NOT NULL"),
|
||||
)
|
||||
op.drop_index("ix_artifacts_run_id_partial", table_name="artifacts", postgresql_where=sa.text("run_id IS NOT NULL"))
|
||||
op.drop_index(
|
||||
"ix_artifacts_observer_thought_id_partial",
|
||||
table_name="artifacts",
|
||||
postgresql_where=sa.text("observer_thought_id IS NOT NULL"),
|
||||
)
|
||||
op.drop_index(
|
||||
"ix_artifacts_observer_cruise_id_partial",
|
||||
table_name="artifacts",
|
||||
postgresql_where=sa.text("observer_cruise_id IS NOT NULL"),
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
0
log/x11vnc.err
Normal file
0
log/x11vnc.err
Normal file
|
|
@ -15,6 +15,7 @@ from sqlalchemy import (
|
|||
UnicodeText,
|
||||
UniqueConstraint,
|
||||
desc,
|
||||
text,
|
||||
)
|
||||
from sqlalchemy.ext.asyncio import AsyncAttrs
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
|
|
@ -205,6 +206,26 @@ class ArtifactModel(Base):
|
|||
__table_args__ = (
|
||||
Index("org_task_step_index", "organization_id", "task_id", "step_id"),
|
||||
Index("artifacts_org_created_at_index", "organization_id", "created_at"),
|
||||
Index(
|
||||
"ix_artifacts_workflow_run_block_id_partial",
|
||||
"workflow_run_block_id",
|
||||
postgresql_where=text("workflow_run_block_id IS NOT NULL"),
|
||||
),
|
||||
Index(
|
||||
"ix_artifacts_observer_thought_id_partial",
|
||||
"observer_thought_id",
|
||||
postgresql_where=text("observer_thought_id IS NOT NULL"),
|
||||
),
|
||||
Index(
|
||||
"ix_artifacts_observer_cruise_id_partial",
|
||||
"observer_cruise_id",
|
||||
postgresql_where=text("observer_cruise_id IS NOT NULL"),
|
||||
),
|
||||
Index(
|
||||
"ix_artifacts_run_id_partial",
|
||||
"run_id",
|
||||
postgresql_where=text("run_id IS NOT NULL"),
|
||||
),
|
||||
)
|
||||
|
||||
artifact_id = Column(String, primary_key=True, default=generate_artifact_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue