"""Add isDefault flag to profile

Revision ID: 0dfb0cdf94bf
Revises: c2c97532f453
Create Date: 2026-03-05 02:07:48.546466

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '0dfb0cdf94bf'
down_revision: Union[str, Sequence[str], None] = 'c2c97532f453'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('rfp_profile', sa.Column('is_default_profile', sa.Boolean(), nullable=True))
    op.execute("UPDATE rfp_profile SET is_default_profile = false WHERE is_default_profile IS NULL")
    op.create_index(
        op.f('rfp_profile_id_idx'),
        'rfp_profile',
        ['id'],
        unique=False,
        if_not_exists=True,
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('rfp_profile_id_idx'), table_name='rfp_profile')
    op.drop_column('rfp_profile', 'is_default_profile')
    # ### end Alembic commands ###
