-- 固件表
DROP TABLE IF EXISTS `app_firmware`;

CREATE TABLE `app_firmware` (
    `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '固件ID',
    `firmware_name` VARCHAR(100) NOT NULL COMMENT '固件名称',
    `firmware_size` BIGINT(20) DEFAULT NULL COMMENT '固件大小（单位：字节）',
    `firmware_description` TEXT DEFAULT NULL COMMENT '固件描述',
    `firmware_type` VARCHAR(50) DEFAULT NULL COMMENT '固件类型',
    `download_url` VARCHAR(500) DEFAULT NULL COMMENT '固件下载地址',
    `create_time` DATETIME DEFAULT NULL COMMENT '创建时间',
    `update_time` DATETIME DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_firmware_name` (`firmware_name`),
    KEY `idx_firmware_type` (`firmware_type`),
    KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='固件表';

-- 插入测试数据（可选）
INSERT INTO `app_firmware` (`firmware_name`, `firmware_size`, `firmware_description`, `firmware_type`, `download_url`)
VALUES
('固件 v1.0.0', 1048576, '第一个版本的固件', '主控固件', 'https://example.com/firmware/v1.0.0.bin'),
('固件 v1.0.1', 1049600, '修复了若干 bug 的版本', '主控固件', 'https://example.com/firmware/v1.0.1.bin');
