CREATE TABLE IF NOT EXISTS puzzles (
    id INT AUTO_INCREMENT PRIMARY KEY,
    game_type VARCHAR(30) NOT NULL,
    difficulty VARCHAR(20) NOT NULL,
    puzzle_date DATE NOT NULL,
    puzzle VARCHAR(200) NOT NULL,
    solution VARCHAR(200) DEFAULT NULL,
    extra JSON DEFAULT NULL,
    source VARCHAR(100) DEFAULT NULL,
    fetched_at DATETIME DEFAULT CURRENT_TIMESTAMP,

    UNIQUE KEY uq_puzzle (game_type, difficulty, puzzle_date)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
