USE mtplayyyy;

SET FOREIGN_KEY_CHECKS=0;

-- Fix admin_ac
ALTER TABLE admin_ac DISCARD TABLESPACE;
ALTER TABLE admin_ac IMPORT TABLESPACE;

-- Fix trx_wingo_game
ALTER TABLE trx_wingo_game DISCARD TABLESPACE;
ALTER TABLE trx_wingo_game IMPORT TABLESPACE;

-- Fix all other tables that may be corrupted
ALTER TABLE `5d` DISCARD TABLESPACE;
ALTER TABLE `5d` IMPORT TABLESPACE;

ALTER TABLE `5d_bet` DISCARD TABLESPACE;
ALTER TABLE `5d_bet` IMPORT TABLESPACE;

ALTER TABLE `admin` DISCARD TABLESPACE;
ALTER TABLE `admin` IMPORT TABLESPACE;

ALTER TABLE `attendance_bonus` DISCARD TABLESPACE;
ALTER TABLE `attendance_bonus` IMPORT TABLESPACE;

ALTER TABLE `bank_recharge` DISCARD TABLESPACE;
ALTER TABLE `bank_recharge` IMPORT TABLESPACE;

ALTER TABLE `claimed_rewards` DISCARD TABLESPACE;
ALTER TABLE `claimed_rewards` IMPORT TABLESPACE;

ALTER TABLE `commissions` DISCARD TABLESPACE;
ALTER TABLE `commissions` IMPORT TABLESPACE;

ALTER TABLE `financial_details` DISCARD TABLESPACE;
ALTER TABLE `financial_details` IMPORT TABLESPACE;

ALTER TABLE `invite` DISCARD TABLESPACE;
ALTER TABLE `invite` IMPORT TABLESPACE;

ALTER TABLE `k3` DISCARD TABLESPACE;
ALTER TABLE `k3` IMPORT TABLESPACE;

ALTER TABLE `k3_bet` DISCARD TABLESPACE;
ALTER TABLE `k3_bet` IMPORT TABLESPACE;

ALTER TABLE `level` DISCARD TABLESPACE;
ALTER TABLE `level` IMPORT TABLESPACE;

ALTER TABLE `minutes_1` DISCARD TABLESPACE;
ALTER TABLE `minutes_1` IMPORT TABLESPACE;

ALTER TABLE `point_list` DISCARD TABLESPACE;
ALTER TABLE `point_list` IMPORT TABLESPACE;

ALTER TABLE `recharge` DISCARD TABLESPACE;
ALTER TABLE `recharge` IMPORT TABLESPACE;

ALTER TABLE `redenvelopes` DISCARD TABLESPACE;
ALTER TABLE `redenvelopes` IMPORT TABLESPACE;

ALTER TABLE `redenvelopes_used` DISCARD TABLESPACE;
ALTER TABLE `redenvelopes_used` IMPORT TABLESPACE;

ALTER TABLE `result_5d` DISCARD TABLESPACE;
ALTER TABLE `result_5d` IMPORT TABLESPACE;

ALTER TABLE `result_k3` DISCARD TABLESPACE;
ALTER TABLE `result_k3` IMPORT TABLESPACE;

ALTER TABLE `result_wingo` DISCARD TABLESPACE;
ALTER TABLE `result_wingo` IMPORT TABLESPACE;

ALTER TABLE `salary` DISCARD TABLESPACE;
ALTER TABLE `salary` IMPORT TABLESPACE;

ALTER TABLE `transactions` DISCARD TABLESPACE;
ALTER TABLE `transactions` IMPORT TABLESPACE;

ALTER TABLE `trx_hash` DISCARD TABLESPACE;
ALTER TABLE `trx_hash` IMPORT TABLESPACE;

ALTER TABLE `trx_wingo` DISCARD TABLESPACE;
ALTER TABLE `trx_wingo` IMPORT TABLESPACE;

ALTER TABLE `trx_wingo_bet` DISCARD TABLESPACE;
ALTER TABLE `trx_wingo_bet` IMPORT TABLESPACE;

ALTER TABLE `trx_wingo_bets` DISCARD TABLESPACE;
ALTER TABLE `trx_wingo_bets` IMPORT TABLESPACE;

ALTER TABLE `user_bank` DISCARD TABLESPACE;
ALTER TABLE `user_bank` IMPORT TABLESPACE;

ALTER TABLE `users` DISCARD TABLESPACE;
ALTER TABLE `users` IMPORT TABLESPACE;

ALTER TABLE `vip_level` DISCARD TABLESPACE;
ALTER TABLE `vip_level` IMPORT TABLESPACE;

ALTER TABLE `wingo` DISCARD TABLESPACE;
ALTER TABLE `wingo` IMPORT TABLESPACE;

ALTER TABLE `wingo_bet` DISCARD TABLESPACE;
ALTER TABLE `wingo_bet` IMPORT TABLESPACE;

ALTER TABLE `withdraw` DISCARD TABLESPACE;
ALTER TABLE `withdraw` IMPORT TABLESPACE;

SET FOREIGN_KEY_CHECKS=1;

SELECT 'InnoDB tablespace repair complete' AS status;
