{
  "query": "CREATE TABLE `achievements` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`name` varchar(128) NOT NULL,\n\t`description` text,\n\t`icon` text,\n\t`category` enum('gameplay','social','spending','milestone','special') NOT NULL,\n\t`condition` text NOT NULL,\n\t`rewardSc` int NOT NULL DEFAULT 0,\n\t`rewardGc` int NOT NULL DEFAULT 0,\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `achievements_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `ai_generated_games` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`originalGameId` int,\n\t`originalGameUrl` text,\n\t`gameName` varchar(255) NOT NULL,\n\t`gameSlug` varchar(255) NOT NULL,\n\t`description` text,\n\t`aiAnalysis` json,\n\t`reelSymbols` json,\n\t`bonusFeatures` json,\n\t`thumbnailUrl` text,\n\t`reelGraphicsUrl` json,\n\t`symbolGraphicsUrl` json,\n\t`rtp` decimal(5,2) NOT NULL DEFAULT 96,\n\t`volatility` enum('low','medium','high') NOT NULL DEFAULT 'medium',\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\tCONSTRAINT `ai_generated_games_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `ai_generated_games_gameSlug_unique` UNIQUE(`gameSlug`)\n);\nCREATE TABLE `ai_social_content` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`createdBy` int NOT NULL,\n\t`platform` enum('facebook','instagram','twitter','tiktok') NOT NULL,\n\t`prompt` text NOT NULL,\n\t`imageUrl` text NOT NULL,\n\t`caption` text,\n\t`hashtags` text,\n\t`isPublished` boolean NOT NULL DEFAULT false,\n\t`publishedAt` timestamp,\n\t`impressions` int NOT NULL DEFAULT 0,\n\t`clicks` int NOT NULL DEFAULT 0,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `ai_social_content_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `friends` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`friendId` int NOT NULL,\n\t`status` enum('pending','accepted','blocked') NOT NULL DEFAULT 'pending',\n\t`requestedAt` timestamp NOT NULL DEFAULT (now()),\n\t`acceptedAt` timestamp,\n\tCONSTRAINT `friends_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `idx_friends_unique` UNIQUE(`userId`,`friendId`)\n);\nCREATE TABLE `game_analytics` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`gameId` int NOT NULL,\n\t`totalSpins` int NOT NULL DEFAULT 0,\n\t`totalWagered` decimal(15,2) NOT NULL DEFAULT 0,\n\t`totalWon` decimal(15,2) NOT NULL DEFAULT 0,\n\t`totalRevenue` decimal(15,2) NOT NULL DEFAULT 0,\n\t`uniquePlayers` int NOT NULL DEFAULT 0,\n\t`avgBetSize` decimal(10,2) NOT NULL DEFAULT 0,\n\t`rtp` decimal(5,2) NOT NULL DEFAULT 96,\n\t`lastUpdated` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `game_analytics_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `game_chat` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`gameId` int,\n\t`userId` int NOT NULL,\n\t`message` text NOT NULL,\n\t`isPublic` boolean NOT NULL DEFAULT true,\n\t`recipientId` int,\n\t`isPinned` boolean NOT NULL DEFAULT false,\n\t`isModerated` boolean NOT NULL DEFAULT false,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `game_chat_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `player_profiles` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`bio` text,\n\t`avatarUrl` text,\n\t`bannerUrl` text,\n\t`totalSpins` int NOT NULL DEFAULT 0,\n\t`totalWins` decimal(15,2) NOT NULL DEFAULT 0,\n\t`favoriteGame` varchar(128),\n\t`level` int NOT NULL DEFAULT 1,\n\t`experience` int NOT NULL DEFAULT 0,\n\t`isPublic` boolean NOT NULL DEFAULT true,\n\t`facebookId` varchar(255),\n\t`instagramHandle` varchar(255),\n\t`twitterHandle` varchar(255),\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\tCONSTRAINT `player_profiles_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `player_profiles_userId_unique` UNIQUE(`userId`)\n);\nCREATE TABLE `referrals` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`referrerId` int NOT NULL,\n\t`refereeId` int NOT NULL,\n\t`referralCode` varchar(32) NOT NULL,\n\t`referralLink` text NOT NULL,\n\t`source` enum('facebook','messenger','sms','twitter','instagram','email','other') NOT NULL,\n\t`status` enum('pending','completed','expired') NOT NULL DEFAULT 'pending',\n\t`referrerRewardGiven` boolean NOT NULL DEFAULT false,\n\t`refereeRewardGiven` boolean NOT NULL DEFAULT false,\n\t`rewardAmount` int NOT NULL DEFAULT 1,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`completedAt` timestamp,\n\tCONSTRAINT `referrals_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `referrals_referralCode_unique` UNIQUE(`referralCode`)\n);\nCREATE TABLE `user_achievements` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`achievementId` int NOT NULL,\n\t`unlockedAt` timestamp NOT NULL DEFAULT (now()),\n\t`rewardClaimed` boolean NOT NULL DEFAULT false,\n\tCONSTRAINT `user_achievements_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `idx_user_achievements_unique` UNIQUE(`userId`,`achievementId`)\n);\nCREATE TABLE `win_share_events` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gameId` int NOT NULL,\n\t`winAmount` decimal(15,2) NOT NULL,\n\t`shareMessage` text NOT NULL,\n\t`platform` enum('facebook','messenger','sms','twitter') NOT NULL,\n\t`referralCode` varchar(32) NOT NULL,\n\t`sharedAt` timestamp NOT NULL DEFAULT (now()),\n\t`clickCount` int NOT NULL DEFAULT 0,\n\tCONSTRAINT `win_share_events_id` PRIMARY KEY(`id`)\n);\nCREATE INDEX `idx_ai_games_slug` ON `ai_generated_games` (`gameSlug`);\nCREATE INDEX `idx_social_content_platform` ON `ai_social_content` (`platform`);\nCREATE INDEX `idx_friends_userId` ON `friends` (`userId`);\nCREATE INDEX `idx_friends_friendId` ON `friends` (`friendId`);\nCREATE INDEX `idx_game_analytics_gameId` ON `game_analytics` (`gameId`);\nCREATE INDEX `idx_game_chat_gameId` ON `game_chat` (`gameId`);\nCREATE INDEX `idx_game_chat_userId` ON `game_chat` (`userId`);\nCREATE INDEX `idx_game_chat_createdAt` ON `game_chat` (`createdAt`);\nCREATE INDEX `idx_player_profiles_userId` ON `player_profiles` (`userId`);\nCREATE INDEX `idx_referrals_referrerId` ON `referrals` (`referrerId`);\nCREATE INDEX `idx_referrals_refereeId` ON `referrals` (`refereeId`);\nCREATE INDEX `idx_referrals_code` ON `referrals` (`referralCode`);\nCREATE INDEX `idx_user_achievements_userId` ON `user_achievements` (`userId`);\nCREATE INDEX `idx_user_achievements_achievementId` ON `user_achievements` (`achievementId`);\nCREATE INDEX `idx_win_share_userId` ON `win_share_events` (`userId`);\nCREATE INDEX `idx_win_share_gameId` ON `win_share_events` (`gameId`);",
  "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway04.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 3sE2opaakiHhpCk.root --database 38mmEpDjJeLLr6ocaGW5p5 --execute CREATE TABLE `achievements` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`name` varchar(128) NOT NULL,\n\t`description` text,\n\t`icon` text,\n\t`category` enum('gameplay','social','spending','milestone','special') NOT NULL,\n\t`condition` text NOT NULL,\n\t`rewardSc` int NOT NULL DEFAULT 0,\n\t`rewardGc` int NOT NULL DEFAULT 0,\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `achievements_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `ai_generated_games` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`originalGameId` int,\n\t`originalGameUrl` text,\n\t`gameName` varchar(255) NOT NULL,\n\t`gameSlug` varchar(255) NOT NULL,\n\t`description` text,\n\t`aiAnalysis` json,\n\t`reelSymbols` json,\n\t`bonusFeatures` json,\n\t`thumbnailUrl` text,\n\t`reelGraphicsUrl` json,\n\t`symbolGraphicsUrl` json,\n\t`rtp` decimal(5,2) NOT NULL DEFAULT 96,\n\t`volatility` enum('low','medium','high') NOT NULL DEFAULT 'medium',\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\tCONSTRAINT `ai_generated_games_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `ai_generated_games_gameSlug_unique` UNIQUE(`gameSlug`)\n);\nCREATE TABLE `ai_social_content` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`createdBy` int NOT NULL,\n\t`platform` enum('facebook','instagram','twitter','tiktok') NOT NULL,\n\t`prompt` text NOT NULL,\n\t`imageUrl` text NOT NULL,\n\t`caption` text,\n\t`hashtags` text,\n\t`isPublished` boolean NOT NULL DEFAULT false,\n\t`publishedAt` timestamp,\n\t`impressions` int NOT NULL DEFAULT 0,\n\t`clicks` int NOT NULL DEFAULT 0,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `ai_social_content_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `friends` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`friendId` int NOT NULL,\n\t`status` enum('pending','accepted','blocked') NOT NULL DEFAULT 'pending',\n\t`requestedAt` timestamp NOT NULL DEFAULT (now()),\n\t`acceptedAt` timestamp,\n\tCONSTRAINT `friends_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `idx_friends_unique` UNIQUE(`userId`,`friendId`)\n);\nCREATE TABLE `game_analytics` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`gameId` int NOT NULL,\n\t`totalSpins` int NOT NULL DEFAULT 0,\n\t`totalWagered` decimal(15,2) NOT NULL DEFAULT 0,\n\t`totalWon` decimal(15,2) NOT NULL DEFAULT 0,\n\t`totalRevenue` decimal(15,2) NOT NULL DEFAULT 0,\n\t`uniquePlayers` int NOT NULL DEFAULT 0,\n\t`avgBetSize` decimal(10,2) NOT NULL DEFAULT 0,\n\t`rtp` decimal(5,2) NOT NULL DEFAULT 96,\n\t`lastUpdated` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `game_analytics_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `game_chat` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`gameId` int,\n\t`userId` int NOT NULL,\n\t`message` text NOT NULL,\n\t`isPublic` boolean NOT NULL DEFAULT true,\n\t`recipientId` int,\n\t`isPinned` boolean NOT NULL DEFAULT false,\n\t`isModerated` boolean NOT NULL DEFAULT false,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `game_chat_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `player_profiles` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`bio` text,\n\t`avatarUrl` text,\n\t`bannerUrl` text,\n\t`totalSpins` int NOT NULL DEFAULT 0,\n\t`totalWins` decimal(15,2) NOT NULL DEFAULT 0,\n\t`favoriteGame` varchar(128),\n\t`level` int NOT NULL DEFAULT 1,\n\t`experience` int NOT NULL DEFAULT 0,\n\t`isPublic` boolean NOT NULL DEFAULT true,\n\t`facebookId` varchar(255),\n\t`instagramHandle` varchar(255),\n\t`twitterHandle` varchar(255),\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\tCONSTRAINT `player_profiles_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `player_profiles_userId_unique` UNIQUE(`userId`)\n);\nCREATE TABLE `referrals` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`referrerId` int NOT NULL,\n\t`refereeId` int NOT NULL,\n\t`referralCode` varchar(32) NOT NULL,\n\t`referralLink` text NOT NULL,\n\t`source` enum('facebook','messenger','sms','twitter','instagram','email','other') NOT NULL,\n\t`status` enum('pending','completed','expired') NOT NULL DEFAULT 'pending',\n\t`referrerRewardGiven` boolean NOT NULL DEFAULT false,\n\t`refereeRewardGiven` boolean NOT NULL DEFAULT false,\n\t`rewardAmount` int NOT NULL DEFAULT 1,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`completedAt` timestamp,\n\tCONSTRAINT `referrals_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `referrals_referralCode_unique` UNIQUE(`referralCode`)\n);\nCREATE TABLE `user_achievements` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`achievementId` int NOT NULL,\n\t`unlockedAt` timestamp NOT NULL DEFAULT (now()),\n\t`rewardClaimed` boolean NOT NULL DEFAULT false,\n\tCONSTRAINT `user_achievements_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `idx_user_achievements_unique` UNIQUE(`userId`,`achievementId`)\n);\nCREATE TABLE `win_share_events` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gameId` int NOT NULL,\n\t`winAmount` decimal(15,2) NOT NULL,\n\t`shareMessage` text NOT NULL,\n\t`platform` enum('facebook','messenger','sms','twitter') NOT NULL,\n\t`referralCode` varchar(32) NOT NULL,\n\t`sharedAt` timestamp NOT NULL DEFAULT (now()),\n\t`clickCount` int NOT NULL DEFAULT 0,\n\tCONSTRAINT `win_share_events_id` PRIMARY KEY(`id`)\n);\nCREATE INDEX `idx_ai_games_slug` ON `ai_generated_games` (`gameSlug`);\nCREATE INDEX `idx_social_content_platform` ON `ai_social_content` (`platform`);\nCREATE INDEX `idx_friends_userId` ON `friends` (`userId`);\nCREATE INDEX `idx_friends_friendId` ON `friends` (`friendId`);\nCREATE INDEX `idx_game_analytics_gameId` ON `game_analytics` (`gameId`);\nCREATE INDEX `idx_game_chat_gameId` ON `game_chat` (`gameId`);\nCREATE INDEX `idx_game_chat_userId` ON `game_chat` (`userId`);\nCREATE INDEX `idx_game_chat_createdAt` ON `game_chat` (`createdAt`);\nCREATE INDEX `idx_player_profiles_userId` ON `player_profiles` (`userId`);\nCREATE INDEX `idx_referrals_referrerId` ON `referrals` (`referrerId`);\nCREATE INDEX `idx_referrals_refereeId` ON `referrals` (`refereeId`);\nCREATE INDEX `idx_referrals_code` ON `referrals` (`referralCode`);\nCREATE INDEX `idx_user_achievements_userId` ON `user_achievements` (`userId`);\nCREATE INDEX `idx_user_achievements_achievementId` ON `user_achievements` (`achievementId`);\nCREATE INDEX `idx_win_share_userId` ON `win_share_events` (`userId`);\nCREATE INDEX `idx_win_share_gameId` ON `win_share_events` (`gameId`);",
  "rows": [],
  "messages": [],
  "stdout": "",
  "stderr": "",
  "execution_time_ms": 21936
}