-- Event Comments and Jackpot Discovery Tables -- Part of the hidden "Jackpot" Easter egg feature -- Event comments table (isolated per participant) CREATE TABLE event_comments ( id SERIAL PRIMARY KEY, participant_id INTEGER NOT NULL REFERENCES participants(id) ON DELETE CASCADE, event_id INTEGER NOT NULL REFERENCES events(id) ON DELETE CASCADE, content TEXT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); -- Indexes for performance CREATE INDEX idx_event_comments_participant ON event_comments(participant_id); CREATE INDEX idx_event_comments_event ON event_comments(event_id); CREATE INDEX idx_event_comments_composite ON event_comments(participant_id, event_id); COMMENT ON TABLE event_comments IS 'Participant feedback comments - visible only to poster (isolated per participant)'; -- Jackpot discoveries tracking table CREATE TABLE jackpot_discoveries ( id SERIAL PRIMARY KEY, participant_id INTEGER NOT NULL REFERENCES participants(id) ON DELETE CASCADE, event_id INTEGER NOT NULL REFERENCES events(id) ON DELETE CASCADE, discovered_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, payload TEXT, score_before INTEGER, score_after INTEGER, UNIQUE(participant_id, event_id) ); -- Indexes for jackpot discoveries CREATE INDEX idx_jackpot_discoveries_event ON jackpot_discoveries(event_id); CREATE INDEX idx_jackpot_discoveries_participant ON jackpot_discoveries(participant_id); COMMENT ON TABLE jackpot_discoveries IS 'Tracks participants who discovered the SQL injection Easter egg';