imetting/backend/sql/create_client_downloads.sql

38 lines
2.6 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

-- 客户端下载管理表
-- 保留 platform_type 和 platform_name 字段以兼容旧终端
-- 新增 platform_code 关联 dict_data 表的码表数据
CREATE TABLE IF NOT EXISTS `client_downloads` (
`id` INT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`platform_type` VARCHAR(50) NULL COMMENT '平台类型兼容旧版mobile, desktop, terminal',
`platform_name` VARCHAR(50) NULL COMMENT '平台名称兼容旧版ios, android, windows等',
`platform_code` VARCHAR(64) NOT NULL COMMENT '平台编码(关联 dict_data.dict_code',
`version` VARCHAR(50) NOT NULL COMMENT '版本号(如 1.0.0',
`version_code` INT NOT NULL COMMENT '版本号数值(用于版本比较)',
`download_url` VARCHAR(512) NOT NULL COMMENT '下载链接',
`file_size` BIGINT NULL COMMENT '文件大小bytes',
`release_notes` TEXT NULL COMMENT '更新说明',
`is_active` BOOLEAN NOT NULL DEFAULT TRUE COMMENT '是否启用',
`is_latest` BOOLEAN NOT NULL DEFAULT FALSE COMMENT '是否为最新版本',
`min_system_version` VARCHAR(50) NULL COMMENT '最低系统版本要求',
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`created_by` INT NULL COMMENT '创建者用户ID',
PRIMARY KEY (`id`),
INDEX `idx_platform_code` (`platform_code`),
INDEX `idx_platform_type_name` (`platform_type`, `platform_name`),
INDEX `idx_is_latest` (`is_latest`),
INDEX `idx_is_active` (`is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户端下载管理表';
-- 插入测试数据示例(包含新旧字段映射)
-- 旧终端使用 platform_type + platform_name
-- 新终端使用 platform_code
-- INSERT INTO client_downloads (platform_type, platform_name, platform_code, version, version_code, download_url, file_size, release_notes, is_active, is_latest, min_system_version, created_by)
-- VALUES
-- ('desktop', 'windows', 'WIN', '1.0.0', 100, 'https://download.example.com/imeeting-win-1.0.0.exe', 52428800, '首个正式版本', TRUE, TRUE, 'Windows 10', 1),
-- ('desktop', 'mac', 'MAC', '1.0.0', 100, 'https://download.example.com/imeeting-mac-1.0.0.dmg', 48234496, '首个正式版本', TRUE, TRUE, 'macOS 11.0', 1),
-- ('mobile', 'ios', 'IOS', '1.0.0', 100, 'https://apps.apple.com/app/imeeting', 45088768, '首个正式版本', TRUE, TRUE, 'iOS 13.0', 1),
-- ('mobile', 'android', 'ANDROID', '1.0.0', 100, 'https://download.example.com/imeeting-android-1.0.0.apk', 38797312, '首个正式版本', TRUE, TRUE, 'Android 8.0', 1);