"""Add waitlist table for WAITLIST_MODE smoke test."""


def up(conn):
    conn.execute("""
        CREATE TABLE IF NOT EXISTS waitlist (
            id          INTEGER PRIMARY KEY AUTOINCREMENT,
            email       TEXT    NOT NULL,
            intent      TEXT    NOT NULL DEFAULT 'signup',
            source      TEXT,
            plan        TEXT,
            ip_address  TEXT,
            created_at  TEXT    NOT NULL DEFAULT (datetime('now')),
            UNIQUE(email, intent)
        )
    """)
    conn.execute(
        "CREATE INDEX IF NOT EXISTS idx_waitlist_email ON waitlist(email)"
    )
