shu/introduce unique key to browser sessions (#4263)
Some checks failed
Run tests and pre-commit / Run tests and pre-commit hooks (push) Waiting to run
Run tests and pre-commit / Frontend Lint and Build (push) Waiting to run
Publish Fern Docs / run (push) Waiting to run
Build Skyvern TS SDK and publish to npm / check-version-change (push) Has been cancelled
Build Skyvern TS SDK and publish to npm / build-and-publish-sdk (push) Has been cancelled

This commit is contained in:
Shuchang Zheng 2025-12-10 14:14:41 -08:00 committed by GitHub
parent e8251701cd
commit 3e9246cb65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,31 @@
"""make browser_address a unique key in persistent_browser_sessions table
Revision ID: cf6ae2f5013c
Revises: 174dcd456325
Create Date: 2025-12-10 22:11:03.926337+00:00
"""
from typing import Sequence, Union
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "cf6ae2f5013c"
down_revision: Union[str, None] = "174dcd456325"
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_unique_constraint(
"uc_persistent_browser_sessions_browser_address", "persistent_browser_sessions", ["browser_address"]
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint("uc_persistent_browser_sessions_browser_address", "persistent_browser_sessions", type_="unique")
# ### end Alembic commands ###

View file

@ -822,7 +822,7 @@ class PersistentBrowserSessionModel(Base):
runnable_type = Column(String, nullable=True)
runnable_id = Column(String, nullable=True, index=True)
browser_id = Column(String, nullable=True)
browser_address = Column(String, nullable=True)
browser_address = Column(String, nullable=True, unique=True)
status = Column(String, nullable=True, default="created")
timeout_minutes = Column(Integer, nullable=True)
ip_address = Column(String, nullable=True)