"""add recipient fields to orders for order for a friend

Revision ID: 33c74347c7c1
Revises: 4e8dc47a5e4c
Create Date: 2026-07-27 13:53:15.685148

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "33c74347c7c1"
down_revision: Union[str, None] = "4e8dc47a5e4c"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


# NOTE: autogenerate also detected a drop of the PostGIS-owned
# `spatial_ref_sys` table and of `refresh_tokens_token_hash_key` — both
# are known spurious drift (PostGIS extension internals and a
# constraint SQLAlchemy's reflection names differently than Postgres
# itself), not real schema changes, and have been stripped by hand.


def upgrade() -> None:
    op.add_column(
        "orders", sa.Column("recipient_name", sa.String(length=100), nullable=True)
    )
    op.add_column(
        "orders", sa.Column("recipient_phone", sa.String(length=20), nullable=True)
    )


def downgrade() -> None:
    op.drop_column("orders", "recipient_phone")
    op.drop_column("orders", "recipient_name")
