CREATE TABLE quiz_questions (
    id           INTEGER PRIMARY KEY AUTOINCREMENT,
    entity_type  TEXT NOT NULL CHECK(entity_type IN ('event','person')),
    entity_id    INTEGER NOT NULL,
    question     TEXT NOT NULL,
    option_a     TEXT NOT NULL,
    option_b     TEXT NOT NULL,
    option_c     TEXT NOT NULL,
    option_d     TEXT NOT NULL,
    correct      TEXT NOT NULL CHECK(correct IN ('a','b','c','d')),
    explanation  TEXT NOT NULL,
    sort_order   INTEGER NOT NULL DEFAULT 0
);
CREATE INDEX idx_quiz_q_entity ON quiz_questions(entity_type, entity_id);
