"""Add name_manually_edited to users

Revision ID: 006
Revises: 005
Create Date: 2025-02-19

When True, full_name/first_name/last_name are not overwritten by get_or_create_user
(Telegram sync). Set manually or via update_user_display_name when editing name in DB/API.
"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

revision: str = "006"
down_revision: Union[str, None] = "005"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column(
        "users",
        sa.Column(
            "name_manually_edited",
            sa.Boolean(),
            nullable=False,
            server_default=sa.text("0"),
        ),
    )


def downgrade() -> None:
    op.drop_column("users", "name_manually_edited")
