-- Migration 007: Fix Quest Table Names
-- Created: 2025-11-12
-- Renames player_daily_quest_progress to player_daily_quests (what backend expects)
-- Only applies if the old table name exists

-- Rename table to match backend expectations (only if old name exists)
SET @table_exists = (SELECT COUNT(*) FROM information_schema.tables
                     WHERE table_schema = DATABASE()
                     AND table_name = 'player_daily_quest_progress');

SET @rename_sql = IF(@table_exists > 0,
                     'RENAME TABLE player_daily_quest_progress TO player_daily_quests',
                     'SELECT "Table already has correct name" AS status');

PREPARE stmt FROM @rename_sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

SELECT 'Migration 007: Fix Quest Table Names - COMPLETED' AS status;
