SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;

USE hyapp_game;

-- 清理旧初始化脚本写入的自研游戏展示入口；不删除对局、钱包、outbox 和奖池流水，避免破坏历史业务事实。
DELETE FROM game_display_rules
WHERE app_code = 'lalu'
  AND game_id IN ('dice', 'rock');

DELETE FROM game_self_game_configs
WHERE app_code = 'lalu'
  AND game_id IN ('dice', 'rock');

DELETE FROM game_self_game_pools
WHERE app_code = 'lalu'
  AND game_id IN ('dice', 'rock');

DELETE FROM game_catalog
WHERE app_code = 'lalu'
  AND game_id IN ('dice', 'rock');

DELETE p
FROM game_platforms p
WHERE p.app_code = 'lalu'
  AND p.platform_code = 'dice'
  AND NOT EXISTS (
    SELECT 1
    FROM game_catalog c
    WHERE c.app_code = p.app_code
      AND c.platform_code = p.platform_code
  );
