"""Add ai_biography_text column to memorials table

Revision ID: 0019
Revises: 0018
Create Date: 2026-06-25 00:00:00.000000

Changes:
  1. ADD ai_biography_text TEXT NULLABLE to memorials

Purpose: Separates the AI-generated draft (ai_biography_text) from the
user-edited copy (biography_text). The left pane of the split biography
editor reads from ai_biography_text; the right TipTap pane saves to
biography_text. This prevents the AI draft from being overwritten when the
staff member saves their own edits.
"""
from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

revision: str = "0019"
down_revision: Union[str, None] = "0018"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column(
        "memorials",
        sa.Column("ai_biography_text", sa.Text(), nullable=True),
    )


def downgrade() -> None:
    op.drop_column("memorials", "ai_biography_text")
