-- Migration: Ajout des tables pour les bonus quotidien et arcade
-- Date: 2026-02-06

-- Table pour le bonus quotidien de connexion
CREATE TABLE IF NOT EXISTS `daily_bonus` (
  `user_id` int NOT NULL,
  `last_claim_date` date DEFAULT NULL,
  `consecutive_days` int DEFAULT 0,
  `total_hints_earned` int DEFAULT 0,
  `total_solutions_earned` int DEFAULT 0,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`user_id`),
  CONSTRAINT `daily_bonus_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Table pour le bonus arcade
CREATE TABLE IF NOT EXISTS `arcade_bonus` (
  `user_id` int NOT NULL,
  `total_games_played` int DEFAULT 0,
  `last_bonus_at` int DEFAULT 0,
  `total_hints_earned` int DEFAULT 0,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`user_id`),
  CONSTRAINT `arcade_bonus_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
