-- BEGIN CHANGE: Jackpot log (Premium Box / surprise bags) + drop legacy lottery
CREATE TABLE IF NOT EXISTS `z_jackpot_log` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `player_id` INT NOT NULL,
  `player_name` VARCHAR(255) NOT NULL,
  `item_id` INT NOT NULL,
  `item_name` VARCHAR(255) NOT NULL,
  `quantity` INT NOT NULL DEFAULT 1,
  `tier` VARCHAR(16) NOT NULL,
  `uses_before` INT NOT NULL DEFAULT 0,
  `source` VARCHAR(32) NOT NULL,
  `created_at` INT UNSIGNED NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_player` (`player_id`),
  KEY `idx_created` (`created_at`),
  KEY `idx_tier` (`tier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `lottery`;
-- END CHANGE
