"""add message status column

Revision ID: 0009
Revises: 0008
Create Date: 2026-02-11 00:00:00.000000
"""

from alembic import op

revision = "0009"
down_revision = "0008"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.execute("""
        DO $$ BEGIN
            ALTER TABLE messages ADD COLUMN status TEXT NOT NULL DEFAULT 'complete';
        EXCEPTION WHEN duplicate_column THEN NULL;
        END $$
    """)


def downgrade() -> None:
    op.execute("ALTER TABLE messages DROP COLUMN IF EXISTS status")
