add browser_session_id to these tables: tasks, workflow_runs & task v2 (#2869)

This commit is contained in:
Shuchang Zheng
2025-07-03 11:57:00 -07:00
committed by GitHub
parent 1a0e5448d8
commit 70661ae5a0
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
"""add browser_session_id to tasks, workflow_runs and task v2 tables
Revision ID: f63892bfc429
Revises: 6cf2c1e15039
Create Date: 2025-07-03 18:37:32.199437+00:00
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "f63892bfc429"
down_revision: Union[str, None] = "6cf2c1e15039"
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.add_column("observer_cruises", sa.Column("browser_session_id", sa.String(), nullable=True))
op.create_index(
op.f("ix_observer_cruises_browser_session_id"), "observer_cruises", ["browser_session_id"], unique=False
)
op.add_column("tasks", sa.Column("browser_session_id", sa.String(), nullable=True))
op.create_index(op.f("ix_tasks_browser_session_id"), "tasks", ["browser_session_id"], unique=False)
op.add_column("workflow_runs", sa.Column("browser_session_id", sa.String(), nullable=True))
op.create_index(op.f("ix_workflow_runs_browser_session_id"), "workflow_runs", ["browser_session_id"], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_workflow_runs_browser_session_id"), table_name="workflow_runs")
op.drop_column("workflow_runs", "browser_session_id")
op.drop_index(op.f("ix_tasks_browser_session_id"), table_name="tasks")
op.drop_column("tasks", "browser_session_id")
op.drop_index(op.f("ix_observer_cruises_browser_session_id"), table_name="observer_cruises")
op.drop_column("observer_cruises", "browser_session_id")
# ### end Alembic commands ###

View File

@@ -61,6 +61,7 @@ class TaskModel(Base):
task_id = Column(String, primary_key=True, default=generate_task_id)
organization_id = Column(String, ForeignKey("organizations.organization_id"))
browser_session_id = Column(String, nullable=True, index=True)
status = Column(String, index=True)
webhook_callback_url = Column(String)
totp_verification_url = Column(String)
@@ -256,6 +257,7 @@ class WorkflowRunModel(Base):
# workfow runs with parent_workflow_run_id are nested workflow runs which won't show up in the workflow run history
parent_workflow_run_id = Column(String, nullable=True, index=True)
organization_id = Column(String, nullable=False, index=True)
browser_session_id = Column(String, nullable=True, index=True)
status = Column(String, nullable=False)
failure_reason = Column(String)
proxy_location = Column(String)
@@ -630,6 +632,7 @@ class TaskV2Model(Base):
workflow_run_id = Column(String, nullable=True)
workflow_id = Column(String, nullable=True)
workflow_permanent_id = Column(String, nullable=True)
browser_session_id = Column(String, nullable=True, index=True)
prompt = Column(UnicodeText, nullable=True)
url = Column(String, nullable=True)
summary = Column(String, nullable=True)