"""converge schedule item status to active or archived Revision ID: 202603250001 Revises: 202603240001 Create Date: 2026-03-25 10:00:00 """ from typing import Sequence, Union from alembic import op revision: str = "202603250001" down_revision: Union[str, Sequence[str], None] = "202603240001" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: op.execute( """ UPDATE public.schedule_items SET status = 'archived' WHERE status IN ('completed', 'canceled') """ ) op.execute( """ ALTER TABLE public.schedule_items DROP CONSTRAINT IF EXISTS chk_schedule_item_status """ ) op.execute( """ ALTER TABLE public.schedule_items ADD CONSTRAINT chk_schedule_item_status CHECK (status IN ('active', 'archived')) """ ) def downgrade() -> None: op.execute( """ ALTER TABLE public.schedule_items DROP CONSTRAINT IF EXISTS chk_schedule_item_status """ ) op.execute( """ ALTER TABLE public.schedule_items ADD CONSTRAINT chk_schedule_item_status CHECK (status IN ('active', 'completed', 'canceled', 'archived')) """ )