"""add browser_profiles table

Revision ID: 7fbf463be9a7
Revises: 2903b6252f31
Create Date: 2025-11-05 01:26:01.764838+00:00

"""

from typing import Sequence, Union

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "7fbf463be9a7"
down_revision: Union[str, None] = "2903b6252f31"
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_table(
        "browser_profiles",
        sa.Column("browser_profile_id", sa.String(), nullable=False),
        sa.Column("organization_id", sa.String(), nullable=False),
        sa.Column("name", sa.String(), nullable=False),
        sa.Column("description", sa.String(), nullable=True),
        sa.Column("created_at", sa.DateTime(), nullable=False),
        sa.Column("modified_at", sa.DateTime(), nullable=False),
        sa.Column("deleted_at", sa.DateTime(), nullable=True),
        sa.PrimaryKeyConstraint("browser_profile_id"),
        sa.UniqueConstraint("organization_id", "name", name="uc_org_browser_profile_name"),
    )
    op.create_index("idx_browser_profiles_org", "browser_profiles", ["organization_id"], unique=False)
    op.create_index("idx_browser_profiles_org_name", "browser_profiles", ["organization_id", "name"], unique=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index("idx_browser_profiles_org_name", table_name="browser_profiles")
    op.drop_index("idx_browser_profiles_org", table_name="browser_profiles")
    op.drop_table("browser_profiles")
    # ### end Alembic commands ###
