Skip to content

Automate browser based workflows with AI

db: add depends_on_workflow_run_id index (#4037)

Shuchang Zhengd055b2fef95b
diff --git a/alembic/versions/2025_11_19_1929-1001a00ed620_add_depends_on_workflow_run_id_index.py b/alembic/versions/2025_11_19_1929-1001a00ed620_add_depends_on_workflow_run_id_index.py
new file mode 100644
index 000000000..6a15e9e31
--- /dev/null
+++ b/alembic/versions/2025_11_19_1929-1001a00ed620_add_depends_on_workflow_run_id_index.py
@@ -0,0 +1,34 @@
+"""add depends_on_workflow_run_id index
+
+Revision ID: 1001a00ed620
+Revises: 39e16cf92225
+Create Date: 2025-11-19 19:29:00.404890+00:00
+
+"""
+
+from typing import Sequence, Union
+
+from alembic import op
+
+# revision identifiers, used by Alembic.
+revision: str = "1001a00ed620"
+down_revision: Union[str, None] = "39e16cf92225"
+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_workflow_runs_depends_on_workflow_run_id"),
+ "workflow_runs",
+ ["depends_on_workflow_run_id"],
+ unique=False,
+ )
+ # ### end Alembic commands ###
+
+
+def downgrade() -> None:
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_index(op.f("ix_workflow_runs_depends_on_workflow_run_id"), table_name="workflow_runs")
+ # ### end Alembic commands ###
diff --git a/skyvern/forge/sdk/db/models.py b/skyvern/forge/sdk/db/models.py
index f5564ae84..b05a3a456 100644
--- a/skyvern/forge/sdk/db/models.py
+++ b/skyvern/forge/sdk/db/models.py
@@ -317,7 +317,7 @@ class WorkflowRunModel(Base):
browser_address = Column(String, nullable=True)
script_run = Column(JSON, nullable=True)
job_id = Column(String, nullable=True, index=True)
- depends_on_workflow_run_id = Column(String, nullable=True)
+ depends_on_workflow_run_id = Column(String, nullable=True, index=True)
sequential_key = Column(String, nullable=True)
run_with = Column(String, nullable=True) # 'agent' or 'code'
debug_session_id: Column = Column(String, nullable=True)