{
  "query": "\nCREATE TABLE `audit_logs` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`actorId` int,\n\t`actorRole` varchar(32),\n\t`targetUserId` int,\n\t`action` varchar(128) NOT NULL,\n\t`category` enum('auth','wallet','game','admin','kyc','staff','system','fraud') NOT NULL,\n\t`details` json,\n\t`ipAddress` varchar(64),\n\t`userAgent` text,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `audit_logs_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `bingo_cards` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`sessionId` int NOT NULL,\n\t`userId` int NOT NULL,\n\t`roomId` int NOT NULL,\n\t`numbers` json NOT NULL,\n\t`daubed` json NOT NULL,\n\t`hasBingo` boolean NOT NULL DEFAULT false,\n\t`winAmount` decimal(18,2) DEFAULT '0.00',\n\t`purchasedAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `bingo_cards_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `bingo_rooms` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`name` varchar(128) NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`ticketPrice` decimal(10,2) NOT NULL,\n\t`maxCards` int NOT NULL DEFAULT 4,\n\t`jackpot` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`jackpotBallLimit` int NOT NULL DEFAULT 76,\n\t`status` enum('open','calling','finished','paused') NOT NULL DEFAULT 'open',\n\t`currentSession` int,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `bingo_rooms_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `bingo_sessions` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`roomId` int NOT NULL,\n\t`calledBalls` json NOT NULL,\n\t`ballCount` int NOT NULL DEFAULT 0,\n\t`prizePool` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`jackpotWon` boolean NOT NULL DEFAULT false,\n\t`winners` json,\n\t`status` enum('active','finished') NOT NULL DEFAULT 'active',\n\t`startedAt` timestamp NOT NULL DEFAULT (now()),\n\t`finishedAt` timestamp,\n\tCONSTRAINT `bingo_sessions_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `casino_games` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`slug` varchar(128) NOT NULL,\n\t`title` varchar(255) NOT NULL,\n\t`provider` varchar(128) NOT NULL,\n\t`category` enum('slots','table','live','jackpot','new','popular','crash','instant') NOT NULL,\n\t`tags` json,\n\t`thumbnailUrl` text,\n\t`bannerUrl` text,\n\t`rtp` float NOT NULL DEFAULT 96,\n\t`volatility` enum('low','medium','high','very_high') NOT NULL DEFAULT 'medium',\n\t`minBetGc` decimal(10,2) NOT NULL DEFAULT '1.00',\n\t`maxBetGc` decimal(10,2) NOT NULL DEFAULT '1000.00',\n\t`minBetSc` decimal(10,2) NOT NULL DEFAULT '0.10',\n\t`maxBetSc` decimal(10,2) NOT NULL DEFAULT '100.00',\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`isFeatured` boolean NOT NULL DEFAULT false,\n\t`isNew` boolean NOT NULL DEFAULT false,\n\t`playCount` bigint NOT NULL DEFAULT 0,\n\t`description` text,\n\t`features` json,\n\t`paylines` int,\n\t`reels` int,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `casino_games_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `casino_games_slug_unique` UNIQUE(`slug`)\n);\nCREATE TABLE `chat_messages` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`channel` varchar(64) NOT NULL DEFAULT 'global',\n\t`message` text NOT NULL,\n\t`isDeleted` boolean NOT NULL DEFAULT false,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `chat_messages_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `coin_packages` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`name` varchar(128) NOT NULL,\n\t`gcAmount` decimal(18,2) NOT NULL,\n\t`scBonusAmount` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`priceUsd` decimal(10,2) NOT NULL,\n\t`isPopular` boolean NOT NULL DEFAULT false,\n\t`isBestValue` boolean NOT NULL DEFAULT false,\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`sortOrder` int NOT NULL DEFAULT 0,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `coin_packages_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `daily_bonuses` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gcAmount` decimal(10,2) NOT NULL,\n\t`scAmount` decimal(10,2) NOT NULL,\n\t`spinResult` int NOT NULL,\n\t`claimedAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `daily_bonuses_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `fraud_alerts` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`alertType` enum('abnormal_rtp','rapid_betting','multi_account','bonus_abuse','unusual_withdrawal','velocity','pattern') NOT NULL,\n\t`severity` enum('low','medium','high','critical') NOT NULL DEFAULT 'medium',\n\t`description` text NOT NULL,\n\t`details` json,\n\t`status` enum('open','investigating','resolved','dismissed') NOT NULL DEFAULT 'open',\n\t`resolvedBy` int,\n\t`resolvedAt` timestamp,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `fraud_alerts_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `game_sessions` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gameId` int NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`betAmount` decimal(18,2) NOT NULL,\n\t`winAmount` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`multiplier` float NOT NULL DEFAULT 0,\n\t`outcome` json,\n\t`rtpApplied` float,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `game_sessions_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `kyc_documents` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`docType` enum('passport','drivers_license','national_id','utility_bill','bank_statement','selfie') NOT NULL,\n\t`fileUrl` text NOT NULL,\n\t`fileKey` text NOT NULL,\n\t`status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',\n\t`reviewedBy` int,\n\t`reviewNote` text,\n\t`submittedAt` timestamp NOT NULL DEFAULT (now()),\n\t`reviewedAt` timestamp,\n\tCONSTRAINT `kyc_documents_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `mini_game_rounds` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gameType` enum('plinko','mines','dice','crash','wheel') NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`betAmount` decimal(18,2) NOT NULL,\n\t`winAmount` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`multiplier` float NOT NULL DEFAULT 0,\n\t`serverSeed` varchar(128) NOT NULL,\n\t`clientSeed` varchar(128),\n\t`nonce` int NOT NULL DEFAULT 0,\n\t`outcome` json NOT NULL,\n\t`isVerified` boolean NOT NULL DEFAULT false,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `mini_game_rounds_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `poker_hands` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`tableId` int NOT NULL,\n\t`handNumber` int NOT NULL,\n\t`players` json NOT NULL,\n\t`communityCards` json,\n\t`pot` decimal(18,2) NOT NULL,\n\t`winners` json,\n\t`actions` json,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `poker_hands_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `poker_tables` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`name` varchar(128) NOT NULL,\n\t`gameType` enum('holdem','omaha') NOT NULL DEFAULT 'holdem',\n\t`currency` enum('GC','SC') NOT NULL,\n\t`smallBlind` decimal(10,2) NOT NULL,\n\t`bigBlind` decimal(10,2) NOT NULL,\n\t`minBuyIn` decimal(10,2) NOT NULL,\n\t`maxBuyIn` decimal(10,2) NOT NULL,\n\t`maxPlayers` int NOT NULL DEFAULT 9,\n\t`currentPlayers` int NOT NULL DEFAULT 0,\n\t`status` enum('waiting','active','paused','closed') NOT NULL DEFAULT 'waiting',\n\t`tournamentId` int,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `poker_tables_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `poker_tournaments` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`name` varchar(255) NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`buyIn` decimal(10,2) NOT NULL,\n\t`prizePool` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`maxPlayers` int NOT NULL,\n\t`registeredPlayers` int NOT NULL DEFAULT 0,\n\t`startTime` timestamp NOT NULL,\n\t`status` enum('registering','running','finished','cancelled') NOT NULL DEFAULT 'registering',\n\t`structure` json,\n\t`payoutStructure` json,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `poker_tournaments_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `recently_played` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gameId` int NOT NULL,\n\t`playedAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `recently_played_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `restricted_states` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`stateCode` varchar(4) NOT NULL,\n\t`stateName` varchar(128) NOT NULL,\n\t`reason` text,\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `restricted_states_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `restricted_states_stateCode_unique` UNIQUE(`stateCode`)\n);\nCREATE TABLE `rtp_overrides` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int,\n\t`gameId` int,\n\t`rtpOverride` float NOT NULL,\n\t`setByAdminId` int NOT NULL,\n\t`reason` text,\n\t`expiresAt` timestamp,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `rtp_overrides_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `sc_redemptions` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`scAmount` decimal(18,2) NOT NULL,\n\t`usdAmount` decimal(18,2) NOT NULL,\n\t`method` enum('bank_transfer','check','paypal','crypto') NOT NULL,\n\t`paymentDetails` json,\n\t`status` enum('pending','approved','processing','completed','rejected') NOT NULL DEFAULT 'pending',\n\t`reviewedBy` int,\n\t`reviewNote` text,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`processedAt` timestamp,\n\tCONSTRAINT `sc_redemptions_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `sport_bets` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`betType` enum('single','parlay','teaser') NOT NULL DEFAULT 'single',\n\t`totalStake` decimal(18,2) NOT NULL,\n\t`totalOdds` float NOT NULL,\n\t`potentialPayout` decimal(18,2) NOT NULL,\n\t`actualPayout` decimal(18,2) DEFAULT '0.00',\n\t`status` enum('pending','won','lost','cancelled','partial_win','void') NOT NULL DEFAULT 'pending',\n\t`selections` json NOT NULL,\n\t`settledAt` timestamp,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `sport_bets_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `sport_events` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`sport` varchar(64) NOT NULL,\n\t`league` varchar(128) NOT NULL,\n\t`homeTeam` varchar(128) NOT NULL,\n\t`awayTeam` varchar(128) NOT NULL,\n\t`startTime` timestamp NOT NULL,\n\t`status` enum('upcoming','live','finished','cancelled','suspended') NOT NULL DEFAULT 'upcoming',\n\t`homeScore` int DEFAULT 0,\n\t`awayScore` int DEFAULT 0,\n\t`period` varchar(32),\n\t`odds` json,\n\t`metadata` json,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\tCONSTRAINT `sport_events_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `staff` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`staffId` varchar(32) NOT NULL,\n\t`pin` varchar(255) NOT NULL,\n\t`position` varchar(128) NOT NULL,\n\t`department` varchar(128),\n\t`hourlyRate` decimal(10,2),\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `staff_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `staff_userId_unique` UNIQUE(`userId`),\n\tCONSTRAINT `staff_staffId_unique` UNIQUE(`staffId`)\n);\nCREATE TABLE `support_tickets` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`assignedStaffId` int,\n\t`subject` varchar(255) NOT NULL,\n\t`category` enum('account','payment','game','bonus','technical','kyc','other') NOT NULL,\n\t`priority` enum('low','medium','high','urgent') NOT NULL DEFAULT 'medium',\n\t`status` enum('open','in_progress','waiting_user','resolved','closed') NOT NULL DEFAULT 'open',\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\t`resolvedAt` timestamp,\n\tCONSTRAINT `support_tickets_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `ticket_messages` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`ticketId` int NOT NULL,\n\t`senderId` int NOT NULL,\n\t`senderRole` enum('user','staff','admin') NOT NULL,\n\t`message` text NOT NULL,\n\t`attachmentUrl` text,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `ticket_messages_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `time_clock` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`staffId` int NOT NULL,\n\t`clockIn` timestamp NOT NULL,\n\t`clockOut` timestamp,\n\t`hoursWorked` float,\n\t`notes` text,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `time_clock_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `transactions` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`type` enum('gc_purchase','gc_bonus','sc_bonus','sc_redeem','game_bet','game_win','sport_bet','sport_win','sport_refund','poker_buyin','poker_win','poker_rake','bingo_purchase','bingo_win','minigame_bet','minigame_win','daily_bonus','admin_credit','admin_debit','referral_bonus','promo_credit') NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`amount` decimal(18,2) NOT NULL,\n\t`balanceBefore` decimal(18,2) NOT NULL,\n\t`balanceAfter` decimal(18,2) NOT NULL,\n\t`referenceId` varchar(128),\n\t`referenceType` varchar(64),\n\t`description` text,\n\t`metadata` json,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `transactions_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `wallets` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gcBalance` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`scBalance` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`lifetimeGcEarned` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`lifetimeScEarned` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`lifetimeScRedeemed` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\tCONSTRAINT `wallets_id` PRIMARY KEY(`id`)\n);\nALTER TABLE `users` MODIFY COLUMN `role` enum('user','staff','admin') NOT NULL DEFAULT 'user';\nALTER TABLE `users` ADD `username` varchar(64);\nALTER TABLE `users` ADD `passwordHash` varchar(255);\nALTER TABLE `users` ADD `kycStatus` enum('none','pending','approved','rejected') DEFAULT 'none' NOT NULL;\nALTER TABLE `users` ADD `kycLevel` int DEFAULT 0 NOT NULL;\nALTER TABLE `users` ADD `isBanned` boolean DEFAULT false NOT NULL;\nALTER TABLE `users` ADD `banReason` text;\nALTER TABLE `users` ADD `isAgeVerified` boolean DEFAULT false NOT NULL;\nALTER TABLE `users` ADD `dateOfBirth` varchar(10);\nALTER TABLE `users` ADD `stateCode` varchar(4);\nALTER TABLE `users` ADD `country` varchar(4) DEFAULT 'US';\nALTER TABLE `users` ADD `phone` varchar(32);\nALTER TABLE `users` ADD `avatarUrl` text;\nALTER TABLE `users` ADD `lastIp` varchar(64);\nALTER TABLE `users` ADD `twoFactorEnabled` boolean DEFAULT false NOT NULL;\nALTER TABLE `users` ADD `twoFactorSecret` varchar(64);\nALTER TABLE `users` ADD CONSTRAINT `users_username_unique` UNIQUE(`username`);\nCREATE INDEX `idx_audit_actorId` ON `audit_logs` (`actorId`);\nCREATE INDEX `idx_audit_createdAt` ON `audit_logs` (`createdAt`);\nCREATE INDEX `idx_audit_category` ON `audit_logs` (`category`);\nCREATE INDEX `idx_cards_sessionId` ON `bingo_cards` (`sessionId`);\nCREATE INDEX `idx_cards_userId` ON `bingo_cards` (`userId`);\nCREATE INDEX `idx_games_provider` ON `casino_games` (`provider`);\nCREATE INDEX `idx_games_category` ON `casino_games` (`category`);\nCREATE INDEX `idx_chat_channel` ON `chat_messages` (`channel`);\nCREATE INDEX `idx_daily_userId` ON `daily_bonuses` (`userId`);\nCREATE INDEX `idx_fraud_userId` ON `fraud_alerts` (`userId`);\nCREATE INDEX `idx_fraud_status` ON `fraud_alerts` (`status`);\nCREATE INDEX `idx_sessions_userId` ON `game_sessions` (`userId`);\nCREATE INDEX `idx_sessions_gameId` ON `game_sessions` (`gameId`);\nCREATE INDEX `idx_minigame_userId` ON `mini_game_rounds` (`userId`);\nCREATE INDEX `idx_hands_tableId` ON `poker_hands` (`tableId`);\nCREATE INDEX `idx_recent_userId` ON `recently_played` (`userId`);\nCREATE INDEX `idx_redemptions_userId` ON `sc_redemptions` (`userId`);\nCREATE INDEX `idx_bets_userId` ON `sport_bets` (`userId`);\nCREATE INDEX `idx_bets_status` ON `sport_bets` (`status`);\nCREATE INDEX `idx_events_sport` ON `sport_events` (`sport`);\nCREATE INDEX `idx_events_status` ON `sport_events` (`status`);\nCREATE INDEX `idx_tickets_userId` ON `support_tickets` (`userId`);\nCREATE INDEX `idx_tickets_status` ON `support_tickets` (`status`);\nCREATE INDEX `idx_messages_ticketId` ON `ticket_messages` (`ticketId`);\nCREATE INDEX `idx_timeclock_staffId` ON `time_clock` (`staffId`);\nCREATE INDEX `idx_transactions_userId` ON `transactions` (`userId`);\nCREATE INDEX `idx_transactions_createdAt` ON `transactions` (`createdAt`);\n",
  "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 \nCREATE TABLE `audit_logs` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`actorId` int,\n\t`actorRole` varchar(32),\n\t`targetUserId` int,\n\t`action` varchar(128) NOT NULL,\n\t`category` enum('auth','wallet','game','admin','kyc','staff','system','fraud') NOT NULL,\n\t`details` json,\n\t`ipAddress` varchar(64),\n\t`userAgent` text,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `audit_logs_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `bingo_cards` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`sessionId` int NOT NULL,\n\t`userId` int NOT NULL,\n\t`roomId` int NOT NULL,\n\t`numbers` json NOT NULL,\n\t`daubed` json NOT NULL,\n\t`hasBingo` boolean NOT NULL DEFAULT false,\n\t`winAmount` decimal(18,2) DEFAULT '0.00',\n\t`purchasedAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `bingo_cards_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `bingo_rooms` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`name` varchar(128) NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`ticketPrice` decimal(10,2) NOT NULL,\n\t`maxCards` int NOT NULL DEFAULT 4,\n\t`jackpot` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`jackpotBallLimit` int NOT NULL DEFAULT 76,\n\t`status` enum('open','calling','finished','paused') NOT NULL DEFAULT 'open',\n\t`currentSession` int,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `bingo_rooms_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `bingo_sessions` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`roomId` int NOT NULL,\n\t`calledBalls` json NOT NULL,\n\t`ballCount` int NOT NULL DEFAULT 0,\n\t`prizePool` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`jackpotWon` boolean NOT NULL DEFAULT false,\n\t`winners` json,\n\t`status` enum('active','finished') NOT NULL DEFAULT 'active',\n\t`startedAt` timestamp NOT NULL DEFAULT (now()),\n\t`finishedAt` timestamp,\n\tCONSTRAINT `bingo_sessions_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `casino_games` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`slug` varchar(128) NOT NULL,\n\t`title` varchar(255) NOT NULL,\n\t`provider` varchar(128) NOT NULL,\n\t`category` enum('slots','table','live','jackpot','new','popular','crash','instant') NOT NULL,\n\t`tags` json,\n\t`thumbnailUrl` text,\n\t`bannerUrl` text,\n\t`rtp` float NOT NULL DEFAULT 96,\n\t`volatility` enum('low','medium','high','very_high') NOT NULL DEFAULT 'medium',\n\t`minBetGc` decimal(10,2) NOT NULL DEFAULT '1.00',\n\t`maxBetGc` decimal(10,2) NOT NULL DEFAULT '1000.00',\n\t`minBetSc` decimal(10,2) NOT NULL DEFAULT '0.10',\n\t`maxBetSc` decimal(10,2) NOT NULL DEFAULT '100.00',\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`isFeatured` boolean NOT NULL DEFAULT false,\n\t`isNew` boolean NOT NULL DEFAULT false,\n\t`playCount` bigint NOT NULL DEFAULT 0,\n\t`description` text,\n\t`features` json,\n\t`paylines` int,\n\t`reels` int,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `casino_games_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `casino_games_slug_unique` UNIQUE(`slug`)\n);\nCREATE TABLE `chat_messages` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`channel` varchar(64) NOT NULL DEFAULT 'global',\n\t`message` text NOT NULL,\n\t`isDeleted` boolean NOT NULL DEFAULT false,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `chat_messages_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `coin_packages` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`name` varchar(128) NOT NULL,\n\t`gcAmount` decimal(18,2) NOT NULL,\n\t`scBonusAmount` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`priceUsd` decimal(10,2) NOT NULL,\n\t`isPopular` boolean NOT NULL DEFAULT false,\n\t`isBestValue` boolean NOT NULL DEFAULT false,\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`sortOrder` int NOT NULL DEFAULT 0,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `coin_packages_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `daily_bonuses` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gcAmount` decimal(10,2) NOT NULL,\n\t`scAmount` decimal(10,2) NOT NULL,\n\t`spinResult` int NOT NULL,\n\t`claimedAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `daily_bonuses_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `fraud_alerts` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`alertType` enum('abnormal_rtp','rapid_betting','multi_account','bonus_abuse','unusual_withdrawal','velocity','pattern') NOT NULL,\n\t`severity` enum('low','medium','high','critical') NOT NULL DEFAULT 'medium',\n\t`description` text NOT NULL,\n\t`details` json,\n\t`status` enum('open','investigating','resolved','dismissed') NOT NULL DEFAULT 'open',\n\t`resolvedBy` int,\n\t`resolvedAt` timestamp,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `fraud_alerts_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `game_sessions` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gameId` int NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`betAmount` decimal(18,2) NOT NULL,\n\t`winAmount` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`multiplier` float NOT NULL DEFAULT 0,\n\t`outcome` json,\n\t`rtpApplied` float,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `game_sessions_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `kyc_documents` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`docType` enum('passport','drivers_license','national_id','utility_bill','bank_statement','selfie') NOT NULL,\n\t`fileUrl` text NOT NULL,\n\t`fileKey` text NOT NULL,\n\t`status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',\n\t`reviewedBy` int,\n\t`reviewNote` text,\n\t`submittedAt` timestamp NOT NULL DEFAULT (now()),\n\t`reviewedAt` timestamp,\n\tCONSTRAINT `kyc_documents_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `mini_game_rounds` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gameType` enum('plinko','mines','dice','crash','wheel') NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`betAmount` decimal(18,2) NOT NULL,\n\t`winAmount` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`multiplier` float NOT NULL DEFAULT 0,\n\t`serverSeed` varchar(128) NOT NULL,\n\t`clientSeed` varchar(128),\n\t`nonce` int NOT NULL DEFAULT 0,\n\t`outcome` json NOT NULL,\n\t`isVerified` boolean NOT NULL DEFAULT false,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `mini_game_rounds_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `poker_hands` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`tableId` int NOT NULL,\n\t`handNumber` int NOT NULL,\n\t`players` json NOT NULL,\n\t`communityCards` json,\n\t`pot` decimal(18,2) NOT NULL,\n\t`winners` json,\n\t`actions` json,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `poker_hands_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `poker_tables` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`name` varchar(128) NOT NULL,\n\t`gameType` enum('holdem','omaha') NOT NULL DEFAULT 'holdem',\n\t`currency` enum('GC','SC') NOT NULL,\n\t`smallBlind` decimal(10,2) NOT NULL,\n\t`bigBlind` decimal(10,2) NOT NULL,\n\t`minBuyIn` decimal(10,2) NOT NULL,\n\t`maxBuyIn` decimal(10,2) NOT NULL,\n\t`maxPlayers` int NOT NULL DEFAULT 9,\n\t`currentPlayers` int NOT NULL DEFAULT 0,\n\t`status` enum('waiting','active','paused','closed') NOT NULL DEFAULT 'waiting',\n\t`tournamentId` int,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `poker_tables_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `poker_tournaments` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`name` varchar(255) NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`buyIn` decimal(10,2) NOT NULL,\n\t`prizePool` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`maxPlayers` int NOT NULL,\n\t`registeredPlayers` int NOT NULL DEFAULT 0,\n\t`startTime` timestamp NOT NULL,\n\t`status` enum('registering','running','finished','cancelled') NOT NULL DEFAULT 'registering',\n\t`structure` json,\n\t`payoutStructure` json,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `poker_tournaments_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `recently_played` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gameId` int NOT NULL,\n\t`playedAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `recently_played_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `restricted_states` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`stateCode` varchar(4) NOT NULL,\n\t`stateName` varchar(128) NOT NULL,\n\t`reason` text,\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `restricted_states_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `restricted_states_stateCode_unique` UNIQUE(`stateCode`)\n);\nCREATE TABLE `rtp_overrides` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int,\n\t`gameId` int,\n\t`rtpOverride` float NOT NULL,\n\t`setByAdminId` int NOT NULL,\n\t`reason` text,\n\t`expiresAt` timestamp,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `rtp_overrides_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `sc_redemptions` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`scAmount` decimal(18,2) NOT NULL,\n\t`usdAmount` decimal(18,2) NOT NULL,\n\t`method` enum('bank_transfer','check','paypal','crypto') NOT NULL,\n\t`paymentDetails` json,\n\t`status` enum('pending','approved','processing','completed','rejected') NOT NULL DEFAULT 'pending',\n\t`reviewedBy` int,\n\t`reviewNote` text,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`processedAt` timestamp,\n\tCONSTRAINT `sc_redemptions_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `sport_bets` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`betType` enum('single','parlay','teaser') NOT NULL DEFAULT 'single',\n\t`totalStake` decimal(18,2) NOT NULL,\n\t`totalOdds` float NOT NULL,\n\t`potentialPayout` decimal(18,2) NOT NULL,\n\t`actualPayout` decimal(18,2) DEFAULT '0.00',\n\t`status` enum('pending','won','lost','cancelled','partial_win','void') NOT NULL DEFAULT 'pending',\n\t`selections` json NOT NULL,\n\t`settledAt` timestamp,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `sport_bets_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `sport_events` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`sport` varchar(64) NOT NULL,\n\t`league` varchar(128) NOT NULL,\n\t`homeTeam` varchar(128) NOT NULL,\n\t`awayTeam` varchar(128) NOT NULL,\n\t`startTime` timestamp NOT NULL,\n\t`status` enum('upcoming','live','finished','cancelled','suspended') NOT NULL DEFAULT 'upcoming',\n\t`homeScore` int DEFAULT 0,\n\t`awayScore` int DEFAULT 0,\n\t`period` varchar(32),\n\t`odds` json,\n\t`metadata` json,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\tCONSTRAINT `sport_events_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `staff` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`staffId` varchar(32) NOT NULL,\n\t`pin` varchar(255) NOT NULL,\n\t`position` varchar(128) NOT NULL,\n\t`department` varchar(128),\n\t`hourlyRate` decimal(10,2),\n\t`isActive` boolean NOT NULL DEFAULT true,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `staff_id` PRIMARY KEY(`id`),\n\tCONSTRAINT `staff_userId_unique` UNIQUE(`userId`),\n\tCONSTRAINT `staff_staffId_unique` UNIQUE(`staffId`)\n);\nCREATE TABLE `support_tickets` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`assignedStaffId` int,\n\t`subject` varchar(255) NOT NULL,\n\t`category` enum('account','payment','game','bonus','technical','kyc','other') NOT NULL,\n\t`priority` enum('low','medium','high','urgent') NOT NULL DEFAULT 'medium',\n\t`status` enum('open','in_progress','waiting_user','resolved','closed') NOT NULL DEFAULT 'open',\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\t`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\t`resolvedAt` timestamp,\n\tCONSTRAINT `support_tickets_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `ticket_messages` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`ticketId` int NOT NULL,\n\t`senderId` int NOT NULL,\n\t`senderRole` enum('user','staff','admin') NOT NULL,\n\t`message` text NOT NULL,\n\t`attachmentUrl` text,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `ticket_messages_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `time_clock` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`staffId` int NOT NULL,\n\t`clockIn` timestamp NOT NULL,\n\t`clockOut` timestamp,\n\t`hoursWorked` float,\n\t`notes` text,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `time_clock_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `transactions` (\n\t`id` bigint AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`type` enum('gc_purchase','gc_bonus','sc_bonus','sc_redeem','game_bet','game_win','sport_bet','sport_win','sport_refund','poker_buyin','poker_win','poker_rake','bingo_purchase','bingo_win','minigame_bet','minigame_win','daily_bonus','admin_credit','admin_debit','referral_bonus','promo_credit') NOT NULL,\n\t`currency` enum('GC','SC') NOT NULL,\n\t`amount` decimal(18,2) NOT NULL,\n\t`balanceBefore` decimal(18,2) NOT NULL,\n\t`balanceAfter` decimal(18,2) NOT NULL,\n\t`referenceId` varchar(128),\n\t`referenceType` varchar(64),\n\t`description` text,\n\t`metadata` json,\n\t`createdAt` timestamp NOT NULL DEFAULT (now()),\n\tCONSTRAINT `transactions_id` PRIMARY KEY(`id`)\n);\nCREATE TABLE `wallets` (\n\t`id` int AUTO_INCREMENT NOT NULL,\n\t`userId` int NOT NULL,\n\t`gcBalance` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`scBalance` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`lifetimeGcEarned` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`lifetimeScEarned` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`lifetimeScRedeemed` decimal(18,2) NOT NULL DEFAULT '0.00',\n\t`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n\tCONSTRAINT `wallets_id` PRIMARY KEY(`id`)\n);\nALTER TABLE `users` MODIFY COLUMN `role` enum('user','staff','admin') NOT NULL DEFAULT 'user';\nALTER TABLE `users` ADD `username` varchar(64);\nALTER TABLE `users` ADD `passwordHash` varchar(255);\nALTER TABLE `users` ADD `kycStatus` enum('none','pending','approved','rejected') DEFAULT 'none' NOT NULL;\nALTER TABLE `users` ADD `kycLevel` int DEFAULT 0 NOT NULL;\nALTER TABLE `users` ADD `isBanned` boolean DEFAULT false NOT NULL;\nALTER TABLE `users` ADD `banReason` text;\nALTER TABLE `users` ADD `isAgeVerified` boolean DEFAULT false NOT NULL;\nALTER TABLE `users` ADD `dateOfBirth` varchar(10);\nALTER TABLE `users` ADD `stateCode` varchar(4);\nALTER TABLE `users` ADD `country` varchar(4) DEFAULT 'US';\nALTER TABLE `users` ADD `phone` varchar(32);\nALTER TABLE `users` ADD `avatarUrl` text;\nALTER TABLE `users` ADD `lastIp` varchar(64);\nALTER TABLE `users` ADD `twoFactorEnabled` boolean DEFAULT false NOT NULL;\nALTER TABLE `users` ADD `twoFactorSecret` varchar(64);\nALTER TABLE `users` ADD CONSTRAINT `users_username_unique` UNIQUE(`username`);\nCREATE INDEX `idx_audit_actorId` ON `audit_logs` (`actorId`);\nCREATE INDEX `idx_audit_createdAt` ON `audit_logs` (`createdAt`);\nCREATE INDEX `idx_audit_category` ON `audit_logs` (`category`);\nCREATE INDEX `idx_cards_sessionId` ON `bingo_cards` (`sessionId`);\nCREATE INDEX `idx_cards_userId` ON `bingo_cards` (`userId`);\nCREATE INDEX `idx_games_provider` ON `casino_games` (`provider`);\nCREATE INDEX `idx_games_category` ON `casino_games` (`category`);\nCREATE INDEX `idx_chat_channel` ON `chat_messages` (`channel`);\nCREATE INDEX `idx_daily_userId` ON `daily_bonuses` (`userId`);\nCREATE INDEX `idx_fraud_userId` ON `fraud_alerts` (`userId`);\nCREATE INDEX `idx_fraud_status` ON `fraud_alerts` (`status`);\nCREATE INDEX `idx_sessions_userId` ON `game_sessions` (`userId`);\nCREATE INDEX `idx_sessions_gameId` ON `game_sessions` (`gameId`);\nCREATE INDEX `idx_minigame_userId` ON `mini_game_rounds` (`userId`);\nCREATE INDEX `idx_hands_tableId` ON `poker_hands` (`tableId`);\nCREATE INDEX `idx_recent_userId` ON `recently_played` (`userId`);\nCREATE INDEX `idx_redemptions_userId` ON `sc_redemptions` (`userId`);\nCREATE INDEX `idx_bets_userId` ON `sport_bets` (`userId`);\nCREATE INDEX `idx_bets_status` ON `sport_bets` (`status`);\nCREATE INDEX `idx_events_sport` ON `sport_events` (`sport`);\nCREATE INDEX `idx_events_status` ON `sport_events` (`status`);\nCREATE INDEX `idx_tickets_userId` ON `support_tickets` (`userId`);\nCREATE INDEX `idx_tickets_status` ON `support_tickets` (`status`);\nCREATE INDEX `idx_messages_ticketId` ON `ticket_messages` (`ticketId`);\nCREATE INDEX `idx_timeclock_staffId` ON `time_clock` (`staffId`);\nCREATE INDEX `idx_transactions_userId` ON `transactions` (`userId`);\nCREATE INDEX `idx_transactions_createdAt` ON `transactions` (`createdAt`);\n",
  "rows": [],
  "messages": [],
  "stdout": "",
  "stderr": "",
  "execution_time_ms": 30583
}