-- =====================================================
-- QUICK DEPLOYMENT - Copy/Paste This Single Command
-- =====================================================
-- For Live Server MySQL Import
-- =====================================================

CREATE TABLE IF NOT EXISTS `champions_bet_cycles` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    `user_id` BIGINT UNSIGNED NOT NULL,
    `consecutive_rounds` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '0-4 (variable cycle length)',
    `cycle_phase` ENUM('loss', 'win') NOT NULL DEFAULT 'loss' COMMENT 'Current phase of the cycle',
    `last_bet_at` TIMESTAMP NULL DEFAULT NULL COMMENT 'Last bet timestamp for tracking',
    `cycle_started_at` TIMESTAMP NULL DEFAULT NULL COMMENT 'When current cycle started',
    `created_at` TIMESTAMP NULL DEFAULT NULL,
    `updated_at` TIMESTAMP NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `champions_bet_cycles_user_id_unique` (`user_id`),
    KEY `champions_bet_cycles_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- VERIFICATION (Run after creation)
-- =====================================================

-- Step 1: Confirm table exists
SHOW TABLES LIKE 'champions_bet_cycles';

-- Step 2: Check structure
DESCRIBE champions_bet_cycles;

-- Step 3: Verify indexes
SHOW INDEX FROM champions_bet_cycles;

-- =====================================================
-- SUCCESS CRITERIA
-- =====================================================
-- ✅ Table appears in SHOW TABLES
-- ✅ 8 columns in DESCRIBE output
-- ✅ 3 indexes (PRIMARY, UNIQUE user_id, INDEX user_id)
-- ✅ No errors in Laravel log after deployment
-- =====================================================
