"""standardize treatment_line values (first_line→1L, second_line→2L)

Revision ID: 47b3a91c20e3
Revises: e116d0ac314d
Create Date: 2026-07-14 08:30:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa


revision: str = '47b3a91c20e3'
down_revision: Union[str, None] = 'e116d0ac314d'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.execute("UPDATE guideline_evidence SET treatment_line = '1L' WHERE treatment_line = 'first_line'")
    op.execute("UPDATE guideline_evidence SET treatment_line = '2L' WHERE treatment_line = 'second_line'")


def downgrade() -> None:
    op.execute("UPDATE guideline_evidence SET treatment_line = 'first_line' WHERE treatment_line = '1L'")
    op.execute("UPDATE guideline_evidence SET treatment_line = 'second_line' WHERE treatment_line = '2L'")
