"""Remove white label table and reference

Revision ID: 3e29a6bf2817
Revises: 63ef3161ca0f
Create Date: 2025-09-13 19:27:57.717311

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '3e29a6bf2817'
down_revision = '63ef3161ca0f'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('redirect_session', 'created_at',
               existing_type=postgresql.TIMESTAMP(timezone=True),
               type_=sa.DateTime(),
               existing_nullable=False,
               existing_server_default=sa.text('now()'))
    op.alter_column('redirect_session', 'modified_at',
               existing_type=postgresql.TIMESTAMP(timezone=True),
               type_=sa.DateTime(),
               existing_nullable=False,
               existing_server_default=sa.text('now()'))
    op.drop_index(op.f('ix_redirect_session_expires_at'), table_name='redirect_session')
    op.drop_index(op.f('ix_redirect_session_organization_id'), table_name='redirect_session')
    op.drop_constraint(op.f('uq_redirect_session_code'), 'redirect_session', type_='unique')
    op.create_index(op.f('ix_redirect_session_code'), 'redirect_session', ['code'], unique=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_redirect_session_code'), table_name='redirect_session')
    op.create_unique_constraint(op.f('uq_redirect_session_code'), 'redirect_session', ['code'], postgresql_nulls_not_distinct=False)
    op.create_index(op.f('ix_redirect_session_organization_id'), 'redirect_session', ['organization_id'], unique=False)
    op.create_index(op.f('ix_redirect_session_expires_at'), 'redirect_session', ['expires_at'], unique=False)
    op.alter_column('redirect_session', 'modified_at',
               existing_type=sa.DateTime(),
               type_=postgresql.TIMESTAMP(timezone=True),
               existing_nullable=False,
               existing_server_default=sa.text('now()'))
    op.alter_column('redirect_session', 'created_at',
               existing_type=sa.DateTime(),
               type_=postgresql.TIMESTAMP(timezone=True),
               existing_nullable=False,
               existing_server_default=sa.text('now()'))
    # ### end Alembic commands ###
