"""Add project title favorite flag.

Revision ID: 004
Revises: 003
Create Date: 2026-06-24
"""

from typing import Sequence, Union

import sqlalchemy as sa

from alembic import op

revision: str = "004"
down_revision: Union[str, None] = "003"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column("project_titles", sa.Column("favorite", sa.Boolean(), nullable=False, server_default=sa.false()))
    op.create_index(op.f("ix_project_titles_favorite"), "project_titles", ["favorite"], unique=False)


def downgrade() -> None:
    op.drop_index(op.f("ix_project_titles_favorite"), table_name="project_titles")
    op.drop_column("project_titles", "favorite")
