Skip to content

Automate browser based workflows with AI

add observer cruise id to artifacts table (#1337)

Shuchang Zheng95bef7f44189
diff --git a/alembic/versions/2024_12_06_0540-3c196d9557da_introduce_observercruise_and_.py b/alembic/versions/2024_12_06_0725-5e266217e9d9_introduce_observercruise_and_.py
similarity index 73%
rename from alembic/versions/2024_12_06_0540-3c196d9557da_introduce_observercruise_and_.py
rename to alembic/versions/2024_12_06_0725-5e266217e9d9_introduce_observercruise_and_.py
index 53ea9a038..f9221dda4 100644
--- a/alembic/versions/2024_12_06_0540-3c196d9557da_introduce_observercruise_and_.py
+++ b/alembic/versions/2024_12_06_0725-5e266217e9d9_introduce_observercruise_and_.py
@@ -1,8 +1,8 @@
-"""Introduce ObserverCruise and ObserverThought. Add workflow_run_block_id to artifacts
+"""Introduce ObserverCruise and ObserverThought. Add workflow_run_block_id and observer_cruise_id to artifacts
-Revision ID: 3c196d9557da
+Revision ID: 5e266217e9d9
Revises: de0254717601
-Create Date: 2024-12-06 05:40:10.408358+00:00
+Create Date: 2024-12-06 07:25:50.080125+00:00
"""
@@ -13,7 +13,7 @@ import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
-revision: str = "3c196d9557da"
+revision: str = "5e266217e9d9"
down_revision: Union[str, None] = "de0254717601"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
@@ -71,19 +71,35 @@ def upgrade() -> None:
)
op.add_column("artifacts", sa.Column("workflow_run_id", sa.String(), nullable=True))
op.add_column("artifacts", sa.Column("workflow_run_block_id", sa.String(), nullable=True))
+ op.add_column("artifacts", sa.Column("observer_cruise_id", sa.String(), nullable=True))
op.create_index("org_workflow_run_index", "artifacts", ["organization_id", "workflow_run_id"], unique=False)
- op.create_foreign_key(None, "artifacts", "workflow_runs", ["workflow_run_id"], ["workflow_run_id"])
op.create_foreign_key(
- None, "artifacts", "workflow_run_blocks", ["workflow_run_block_id"], ["workflow_run_block_id"]
+ "artifacts_workflow_run_block_id_fkey",
+ "artifacts",
+ "workflow_run_blocks",
+ ["workflow_run_block_id"],
+ ["workflow_run_block_id"],
+ )
+ op.create_foreign_key(
+ "artifacts_observer_cruise_id_fkey",
+ "artifacts",
+ "observer_cruises",
+ ["observer_cruise_id"],
+ ["observer_cruise_id"],
+ )
+ op.create_foreign_key(
+ "artifacts_workflow_run_id_fkey", "artifacts", "workflow_runs", ["workflow_run_id"], ["workflow_run_id"]
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
- op.drop_constraint(None, "artifacts", type_="foreignkey")
- op.drop_constraint(None, "artifacts", type_="foreignkey")
+ op.drop_constraint("artifacts_workflow_run_block_id_fkey", "artifacts", type_="foreignkey")
+ op.drop_constraint("artifacts_observer_cruise_id_fkey", "artifacts", type_="foreignkey")
+ op.drop_constraint("artifacts_workflow_run_id_fkey", "artifacts", type_="foreignkey")
op.drop_index("org_workflow_run_index", table_name="artifacts")
+ op.drop_column("artifacts", "observer_cruise_id")
op.drop_column("artifacts", "workflow_run_block_id")
op.drop_column("artifacts", "workflow_run_id")
op.drop_table("observer_thoughts")
diff --git a/skyvern/forge/sdk/db/models.py b/skyvern/forge/sdk/db/models.py
index 4dd2b2ef4..565ed5d68 100644
--- a/skyvern/forge/sdk/db/models.py
+++ b/skyvern/forge/sdk/db/models.py
@@ -168,6 +168,7 @@ class ArtifactModel(Base):
organization_id = Column(String, ForeignKey("organizations.organization_id"))
workflow_run_id = Column(String, ForeignKey("workflow_runs.workflow_run_id"))
workflow_run_block_id = Column(String, ForeignKey("workflow_run_blocks.workflow_run_block_id"))
+ observer_cruise_id = Column(String, ForeignKey("observer_cruises.observer_cruise_id"))
task_id = Column(String, ForeignKey("tasks.task_id"))
step_id = Column(String, ForeignKey("steps.step_id"), index=True)
artifact_type = Column(String)