-- Flame USDC — License database
-- Import vào MySQL (phpMyAdmin hoặc CLI)

CREATE TABLE IF NOT EXISTS activation_codes (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    code VARCHAR(64) NOT NULL,
    plan ENUM('1M', '3M', '6M', '1Y', 'LIFE') NOT NULL DEFAULT '1M',
    status ENUM('active', 'disabled') NOT NULL DEFAULT 'active',
    note VARCHAR(255) DEFAULT NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    activated_at DATETIME DEFAULT NULL,
    expires_at DATETIME DEFAULT NULL,
    last_check_at DATETIME DEFAULT NULL,
  last_ip VARCHAR(45) DEFAULT NULL,
    UNIQUE KEY uk_code (code),
    KEY idx_status (status),
    KEY idx_expires (expires_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
