-- WiFi配置表
CREATE TABLE IF NOT EXISTS wifi_configurations (
  id INT AUTO_INCREMENT PRIMARY KEY,
  device_clientid VARCHAR(255) NOT NULL COMMENT '设备客户端ID',
  ssid VARCHAR(32) NOT NULL COMMENT 'WiFi SSID',
  password VARCHAR(64) NOT NULL COMMENT 'WiFi密码',
  status ENUM('pending', 'sent', 'applied', 'failed') DEFAULT 'sent' COMMENT '配置状态：pending-待发送，sent-已发送，applied-已应用，failed-失败',
  sent_at TIMESTAMP NULL COMMENT '发送时间',
  applied_at TIMESTAMP NULL COMMENT '应用时间',
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  INDEX idx_device_clientid (device_clientid),
  INDEX idx_status (status),
  INDEX idx_created_at (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='设备WiFi配置表';
