add browser session query index (#4164)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""add browser session history index
|
||||
|
||||
Revision ID: 24bd4ab81e07
|
||||
Revises: 1001a00ed620
|
||||
Create Date: 2025-12-02 17:17:28.644094+00:00
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "24bd4ab81e07"
|
||||
down_revision: Union[str, None] = "1001a00ed620"
|
||||
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(
|
||||
"idx_persistent_browser_sessions_org_created_started_completed",
|
||||
"persistent_browser_sessions",
|
||||
["organization_id", "created_at", "started_at", "completed_at"],
|
||||
unique=False,
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(
|
||||
"idx_persistent_browser_sessions_org_created_started_completed", table_name="persistent_browser_sessions"
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
@@ -793,6 +793,15 @@ class ThoughtModel(Base):
|
||||
|
||||
class PersistentBrowserSessionModel(Base):
|
||||
__tablename__ = "persistent_browser_sessions"
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"idx_persistent_browser_sessions_org_created_started_completed",
|
||||
"organization_id",
|
||||
"created_at",
|
||||
"started_at",
|
||||
"completed_at",
|
||||
),
|
||||
)
|
||||
|
||||
persistent_browser_session_id = Column(String, primary_key=True, default=generate_persistent_browser_session_id)
|
||||
organization_id = Column(String, nullable=False, index=True)
|
||||
|
||||
Reference in New Issue
Block a user