"""Migration 0023: Add visible_from to lead_requests for 2-hour admin review window."""


def up(conn) -> None:
    conn.execute("ALTER TABLE lead_requests ADD COLUMN visible_from TEXT")
    # Backfill: existing verified leads are already past review — make them visible immediately
    conn.execute(
        "UPDATE lead_requests SET visible_from = created_at WHERE status = 'new' AND verified_at IS NOT NULL"
    )
