"""article_scores: per-article map-phase grades for threshold tuning Revision ID: 012_article_scores Revises: 011_geofence_alerts_fence Create Date: 2026-11-13 """ from alembic import op revision = "012_article_scores" down_revision = "011_geofence_alerts_fence" branch_labels = None depends_on = None def upgrade() -> None: op.execute( """ CREATE TABLE IF NOT EXISTS article_scores ( article_id INTEGER NOT NULL, summary_id INTEGER, score INTEGER NOT NULL, category TEXT, selected BOOLEAN NOT NULL, model TEXT, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), PRIMARY KEY (article_id, created_at) ) """ ) op.execute( "CREATE INDEX IF NOT EXISTS ix_article_scores_summary " "ON article_scores (summary_id)" ) def downgrade() -> None: op.execute("DROP INDEX IF EXISTS ix_article_scores_summary") op.execute("DROP TABLE IF EXISTS article_scores")