"""add public_access_token Revision ID: 181475b2a1a1 Revises: dc33eef8dabe Create Date: 2026-01-23 17:37:54.449308 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "181475b2a1a1" down_revision: Union[str, None] = "dc33eef8dabe" 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.drop_index(op.f("ix_api_keys_key_hash"), table_name="api_keys") op.create_index("ix_api_keys_key_hash", "api_keys", ["key_hash"], unique=False) op.create_index( "ix_kb_chunks_embedding_model", "knowledge_base_chunks", ["embedding_model"], unique=False, ) op.add_column( "workflow_runs", sa.Column("public_access_token", sa.String(length=36), nullable=True), ) op.create_index( "idx_workflow_runs_public_access_token", "workflow_runs", ["public_access_token"], unique=True, postgresql_where=sa.text("public_access_token IS NOT NULL"), ) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_index( "idx_workflow_runs_public_access_token", table_name="workflow_runs", postgresql_where=sa.text("public_access_token IS NOT NULL"), ) op.drop_column("workflow_runs", "public_access_token") op.drop_index("ix_kb_chunks_embedding_model", table_name="knowledge_base_chunks") op.drop_index("ix_api_keys_key_hash", table_name="api_keys") op.create_index(op.f("ix_api_keys_key_hash"), "api_keys", ["key_hash"], unique=True) # ### end Alembic commands ###