build: # 内部构建版本信息 1.0.7: # 版本号 3: # 迭代号 - "alter table config add installed int default 1 not null comment '0=否;1=是';" 4: - "alter table vmhost add flow_limit bigint default 0 not null comment '月流量上限' after bwlimit;" - "alter table vmhost add used_flow double default 0 not null comment '已用流量' after flow_limit;" - "create table flowdata ( id int auto_increment, node_id int null, hostid int null, rrd json null, used_flow double default 0 not null comment '已用流量', status int default 0 not null comment '0=未同步;1=已同步', create_date varchar(20) null, constraint flowdata_pk primary key (id) );" - "alter table vncnode modify port int default 7600 not null comment '控制器端口';" - "alter table vncnode add proxy int default 0 not null comment '0=false;1=true' after protocol;" - "alter table vmhost add last_reset_flow bigint default 0 not null comment '上次重置流量月份' after used_flow;" 5: - "alter table vmhost add mbps_rd int default 0 not null comment '读取长效限制 单位mb/s' after system_disk_size; alter table vmhost add mbps_rd_max int default 0 not null comment '读取突发限制 单位mb/s' after mbps_rd; alter table vmhost add mbps_wr int default 0 not null comment '写长效限制 单位mb/s' after mbps_rd_max; alter table vmhost add mbps_wr_max int default 0 not null comment '写突发限制 单位mb/s' after mbps_wr; alter table vmhost add iops_rd int default 0 not null comment 'iops读长效限制 单位ops/s' after mbps_wr_max; alter table vmhost add iops_rd_max int default 0 not null comment 'iops读突发限制 单位ops/s' after iops_rd; alter table vmhost add iops_wr int default 0 not null comment 'iops写长效限制 单位ops/s' after iops_rd_max; alter table vmhost add iops_wr_max int default 0 not null comment 'iops写突发限制 单位ops/s' after iops_wr;" 1.0.8: 1: - "create table zones ( id int auto_increment, node_id int null, type varchar(255) null, zone varchar(255) null, nodes varchar(255) null, ipam varchar(255) null, dns varchar(255) null, reversedns varchar(255) null, state varchar(255) default 'new' not null, constraint zones_pk primary key (id) );" - "create table vnets ( id int auto_increment, vnet varchar(255) null, zone varchar(255) null, alias varchar(255) null, tag int null, type varchar(255) default 'vnet' not null, state varchar(255) default 'new' not null, constraint vnets_pk primary key (id) );" - "create table subnet ( id int auto_increment, nodeid int null, subnet varchar(255) null, type varchar(255) default 'subnet' not null, vnet varchar(255) not null, gateway varchar(255) null, dns varchar(255) null, snat int default 0 not null, available int default 0 not null, used int default 0 not null, disable int default 0 not null, state varchar(255) default 'new' not null, constraint subnet_pk primary key (id) );" - "create table subnetpool ( id int auto_increment, node_id int null, vm_id int null, subnat_id int null, ip varchar(255) null, mask varchar(15) null, gateway varchar(15) null, mac varchar(255) null, dns varchar(15) null, status int default 0 not null, constraint subnetpool_pk primary key (id) );" - "create table natcontroller ( id int auto_increment, name varchar(255) null, host varchar(255) null, port int null, port_range varchar(255) null, status int default 0 not null, constraint natcontroller_pk primary key (id) );" 1.1.0: 1: - "alter table master add naton int default 0 not null comment '0关闭 1开启' after controller_port;" - "alter table master add natbridge varchar(50) null comment 'nat网口' after naton;" - "alter table master add natippool int default 0 not null comment 'nat ip池id' after natbridge;" - "alter table master add nataddr varchar(50) null comment 'nat展示地址' after natippool;" - "alter table vmhost add ifnat int default 0 not null comment '是否开启NAT' after ip_list;" - "alter table vmhost add natnum int default 0 not null comment 'NAT数量' after ifnat;" 1.1.1: 1: - "alter table vmhost add extra_flow_limit bigint default 0 not null comment '临时流量包' after natnum;" 2: - "alter table vmhost add reset_flow_time int default 0 not null comment '流量重置日 0开通日 1月初' after extra_flow_limit;" 3: - "alter table vmhost add out_flow int default 0 not null comment '超流操作0挂起 大于0表示限速x 单位kb' after reset_flow_time;" 1.1.2: 1: - "alter table vmhost add delete_state int default 0 not null comment '删除状态 0正常 1回收站 2已删除' after out_flow;" 1.2.0: 1: - "create table vm_resource_rank ( id int auto_increment, rank_type varchar(20) not null comment 'cpu or memory', rank_no int not null comment 'rank number', host_id int null, vmid int null, hostname varchar(255) null, node_id int null, node_name varchar(255) null, cpu double default 0 not null, cpu_percent double default 0 not null, memory bigint default 0 not null, memory_mb double default 0 not null, max_memory bigint default 0 not null, max_memory_mb double default 0 not null, memory_percent double default 0 not null, collect_time bigint not null, constraint vm_resource_rank_pk primary key (id), index vm_resource_rank_type_no_index (rank_type, rank_no) );" - "alter table master add backup_storage varchar(255) null comment '备份存储' after auto_storage;" - "alter table area add geo varchar(255) null comment '地理信息' after name;" 2: - "alter table flowdata add index idx_flowdata_host_status_create_date (hostid, status, create_date);" - "alter table vmhost add index idx_vmhost_status_nodeid (status, nodeid);" - "alter table vmhost add index idx_vmhost_reset_flow_time (reset_flow_time);" 3: - "create table if not exists system_log ( id int auto_increment, request_id varchar(64) null, log_type varchar(32) null, level varchar(16) null, method varchar(16) null, uri varchar(255) null, path_pattern varchar(255) null, handler varchar(255) null, client_ip varchar(64) null, operator varchar(255) null, auth_type varchar(32) null, query_string text null, request_body text null, http_status int null, business_code int null, business_message varchar(255) null, response_body text null, duration_ms bigint null, exception text null, content text null, create_time bigint null, constraint system_log_pk primary key (id), index idx_system_log_create_time (create_time), index idx_system_log_type_create_time (log_type, create_time), index idx_system_log_request_id (request_id), index idx_system_log_level (level) );" 4: - "alter table system_log modify business_message text null;" 5: - "update vmhost v join os o on v.os_name = cast(o.id as char) set v.os_name = o.name where o.name is not null and o.name <> '' and v.os_name is not null;" - "update vmhost v join os o on v.os_name = o.file_name set v.os_name = o.name where o.name is not null and o.name <> '' and v.os_name is not null;" - "update vmhost v join os o on v.os = o.file_name set v.os_name = o.name where o.name is not null and o.name <> '' and (v.os_name is null or v.os_name = '');" - "update vmhost v join os o on v.os = o.name set v.os_name = o.name where o.name is not null and o.name <> '' and (v.os_name is null or v.os_name = '');" - "update vmhost v join os o on v.os = cast(o.id as char) set v.os_name = o.name where o.name is not null and o.name <> '' and (v.os_name is null or v.os_name = '');" 6: - "alter table vmhost add network_type varchar(20) default 'classic' not null comment '网络类型 classic/vpc' after bridge;" - "alter table vmhost add vpc_subnet_id int null comment 'VPC子网ID' after network_type;" - "update vmhost v join os o on v.os = o.name set v.os_name = o.name where o.name is not null and o.name <> '' and (v.os_name is null or v.os_name = '');" - "update vmhost v join os o on v.os = cast(o.id as char) set v.os_name = o.name where o.name is not null and o.name <> '' and (v.os_name is null or v.os_name = '');" 7: - "create table if not exists vpc_ip_binding ( id int auto_increment primary key, host_id int not null comment '虚拟机主机ID', vm_id int null comment 'Proxmox VMID', node_id int not null comment '节点ID', vpc_subnet_id int null comment 'VPC子网ID', ippool_id int null comment '公网IP池明细ID', subnetpool_id int null comment '私网IP池明细ID', public_ip varchar(64) not null comment '公网IP', private_ip varchar(64) not null comment '私网IP', forward_mode varchar(20) default 'nat_1to1' not null comment '转发模式', status int default 1 not null comment '状态 0已删除 1有效', create_time bigint null, update_time bigint null, index idx_vpc_ip_binding_host_status (host_id, status), index idx_vpc_ip_binding_public_ip (public_ip), index idx_vpc_ip_binding_private_ip (private_ip) ) comment 'VPC公网IP与私网IP绑定关系';" 8: - "alter table vmhost modify network_type varchar(20) default 'classic' not null comment '网络类型 classic/vpc';" - "alter table vmhost modify vpc_subnet_id int null comment 'VPC子网ID';" - "alter table vpc_ip_binding comment 'VPC公网IP与私网IP绑定关系';" - "alter table vpc_ip_binding modify host_id int not null comment '虚拟机主机ID', modify vm_id int null comment 'Proxmox VMID', modify node_id int not null comment '节点ID', modify vpc_subnet_id int null comment 'VPC子网ID', modify ippool_id int null comment '公网IP池明细ID', modify subnetpool_id int null comment '私网IP池明细ID', modify public_ip varchar(64) not null comment '公网IP', modify private_ip varchar(64) not null comment '私网IP', modify forward_mode varchar(20) default 'nat_1to1' not null comment '转发模式', modify status int default 1 not null comment '状态 0已删除 1有效';" 9: - "create table if not exists security_group ( id int auto_increment primary key, name varchar(100) not null comment '安全组名称', description varchar(255) null comment '描述', default_ingress_action varchar(20) default 'drop' not null comment '默认入站动作 accept/drop', default_egress_action varchar(20) default 'accept' not null comment '默认出站动作 accept/drop', is_template int default 0 not null comment '是否模板 0否 1是', is_default int default 0 not null comment '是否默认安全组 0否 1是', status int default 1 not null comment '状态 0已删除 1有效', create_time bigint null, update_time bigint null, index idx_security_group_status (status), index idx_security_group_template_default (is_template, is_default) ) comment '安全组';" - "create table if not exists security_group_rule ( id int auto_increment primary key, group_id int not null comment '安全组ID', direction varchar(20) default 'ingress' not null comment '方向 ingress/egress', protocol varchar(20) default 'all' not null comment '协议 tcp/udp/icmp/all', port_start int null comment '起始端口或ICMP类型', port_end int null comment '结束端口', remote_cidr varchar(64) default '0.0.0.0/0' not null comment '远端CIDR', remote_group_id int null comment '引用安全组ID', action varchar(20) default 'accept' not null comment '动作 accept/drop', priority int default 100 not null comment '优先级,数字越小越优先', remark varchar(255) null comment '备注', status int default 1 not null comment '状态 0已删除 1有效', create_time bigint null, update_time bigint null, index idx_security_group_rule_group (group_id, status, priority), index idx_security_group_rule_remote_group (remote_group_id) ) comment '安全组规则';" - "create table if not exists security_group_binding ( id int auto_increment primary key, group_id int not null comment '安全组ID', host_id int not null comment '虚拟机主机ID', vm_id int null comment 'Proxmox VMID', node_id int not null comment '节点ID', network_type varchar(20) default 'classic' not null comment '网络类型 classic/vpc', status int default 1 not null comment '状态 0已删除 1有效', create_time bigint null, update_time bigint null, index idx_security_group_binding_host (host_id, status), index idx_security_group_binding_group (group_id, status) ) comment '安全组绑定';" - "create table if not exists security_group_sync ( id int auto_increment primary key, host_id int not null comment '虚拟机主机ID', vm_id int null comment 'Proxmox VMID', node_id int not null comment '节点ID', rule_hash varchar(128) null comment '规则哈希', in_sync int default 0 not null comment '是否一致 0否 1是', last_message varchar(255) null comment '最后同步消息', last_sync_time bigint null comment '最后同步时间', index idx_security_group_sync_host (host_id), index idx_security_group_sync_node (node_id) ) comment '安全组同步状态';" 10: - "alter table security_group add host_id int null comment '虚拟机主机ID' after id;" - "alter table security_group add index idx_security_group_host_status (host_id, status);" 1.2.1: 1: - "alter table subnetpool add unique index uk_subnetpool_node_subnet_ip (node_id, subnat_id, ip);" 2: - "create table if not exists vm_init_script ( id int auto_increment primary key, name varchar(100) not null comment '初始化脚本名称', script_type varchar(20) default 'shell' not null comment '脚本类型 shell', run_mode varchar(20) default 'qemu_agent' not null comment '运行模式 qemu_agent', content mediumtext not null comment '脚本内容', timeout_seconds int default 300 not null comment '执行超时时间秒', status int default 1 not null comment '状态 0删除 1启用 2停用', remark varchar(255) null comment '备注', create_time bigint null, update_time bigint null, index idx_vm_init_script_status (status) ) comment '虚拟机初始化脚本模板';" - "create table if not exists vm_init_script_record ( id int auto_increment primary key, script_id int not null comment '初始化脚本ID', host_id int not null comment '虚拟机主机ID', vmid int null comment 'Proxmox VMID', node_id int not null comment '节点ID', trigger_type varchar(20) not null comment '触发类型 create/reinstall/manual', status varchar(20) default 'pending' not null comment '执行状态 pending/running/success/failed', pid int null comment 'QEMU Guest Agent进程ID', exit_code int null comment '退出码', stdout mediumtext null comment '标准输出', stderr mediumtext null comment '标准错误', error text null comment '错误信息', run_count int default 0 not null comment '执行次数', create_time bigint null, update_time bigint null, start_time bigint null, finish_time bigint null, index idx_vm_init_script_record_host (host_id, status), index idx_vm_init_script_record_script (script_id), index idx_vm_init_script_record_node (node_id) ) comment '虚拟机初始化脚本执行记录';" 3: - "alter table vm_init_script add target_os varchar(20) default 'auto' not null comment '目标系统 auto/linux/windows' after run_mode;" - "alter table vm_init_script add linux_content mediumtext null comment 'Linux脚本内容' after content;" - "alter table vm_init_script add windows_content mediumtext null comment 'Windows脚本内容' after linux_content;" 4: - "alter table ipstatus add ip_version int default 4 not null comment 'IP版本 4/6' after gateway;" - "alter table ipstatus modify gateway varchar(64) null, modify dns1 varchar(64) null, modify dns2 varchar(64) null;" - "alter table ippool add ip_version int default 4 not null comment 'IP版本 4/6' after ip;" - "alter table ippool modify ip varchar(64) not null, modify subnet_mask varchar(64) not null, modify gateway varchar(64) not null, modify dns1 varchar(64) null, modify dns2 varchar(64) null;" 1.3.1: 3: - "create table if not exists nat_forward_rule ( id int auto_increment primary key, rule_key varchar(255) not null comment '规则唯一键', rule_type varchar(20) not null comment '规则类型 port/ip', node_id int not null comment '宿主机节点ID', host_id int not null comment '虚拟机主机ID', source_ip varchar(64) not null, source_port int null, destination_ip varchar(64) not null, destination_port int null, protocol varchar(10) null, create_time bigint null, update_time bigint null, unique index uk_nat_forward_rule_key (rule_key), index idx_nat_forward_rule_host (host_id, rule_type), index idx_nat_forward_rule_node (node_id, rule_type) ) comment '主控NAT转发规则';" - "create table if not exists nat_sync_state ( id int auto_increment primary key, node_id int not null comment '宿主机节点ID', initial_imported int default 0 not null comment '是否完成首次导入 0否 1是', in_sync int default 0 not null comment '是否同步正常 0否 1是', last_message varchar(255) null, last_import_time bigint null, last_sync_time bigint null, unique index uk_nat_sync_state_node (node_id) ) comment 'NAT规则同步状态';" 4: - "alter table vmhost add flow_type varchar(10) default 'in+out' not null comment '流量计费类型 in/out/in+out' after used_flow;" - "update vmhost set flow_type = 'in+out' where flow_type is null or trim(flow_type) = '' or flow_type not in ('in', 'out', 'in+out');" 1.3.2: 2: - "alter table ippool add unique index uk_ippool_node_version_ip (node_id, ip_version, ip);" 5: - "alter table system_log add host_id int null comment '虚拟机数据库ID' after uri, add index idx_system_log_host_id_create_time (host_id, create_time);" 6: - "alter table flowdata add in_flow double default 0 not null comment '入站流量(对应PVE netin)' after used_flow, add out_flow double default 0 not null comment '出站流量(对应PVE netout)' after in_flow;" 1.3.3: 1: - "alter table vmhost add used_in_flow double default 0 not null comment '当月入站/下行流量(单位字节)' after used_flow, add used_out_flow double default 0 not null comment '当月出站/上行流量(单位字节)' after used_in_flow;" 3: - "alter table vmhost add last_disk_reconcile_time bigint default 0 not null comment '上次校正虚拟机磁盘显示容量时间戳(毫秒)' after delete_state, add index idx_vmhost_disk_reconcile (delete_state, last_disk_reconcile_time);" 4: - "alter table master drop column ssh_password;" - "alter table master drop column ssh_username;" - "alter table master drop column ssh_port;" 1.3.4: 1: - "alter table configuretemplate add vga varchar(20) null comment '显示设备类型(std/qxl/virtio等),决定VNC控制台默认分辨率' after storage;" 3: - "alter table master modify password text not null, modify csrf_token text null;" - "alter table vmhost modify password text null;" - "alter table vncinfo modify password text null comment '加密的虚拟机凭据';" 1.3.4_4: 1: - "alter table sysuser add mfa_type varchar(16) default 'none' not null comment '二步验证方式 none/totp/passkey' after logindate, add totp_secret text null comment '加密存储的TOTP密钥(新密钥Base32,兼容历史Base64URL)' after mfa_type, add totp_confirmed_time bigint null comment 'TOTP绑定确认时间戳(毫秒)' after totp_secret, add totp_last_step bigint null comment '最近一次已消费的TOTP时间片' after totp_confirmed_time, add passkey_enabled int default 0 not null comment '是否已绑定Passkey 0否 1是' after totp_last_step;" - "update sysuser set mfa_type = 'none' where mfa_type is null or trim(mfa_type) = '';" 2: - "create table if not exists sys_passkey ( id bigint auto_increment primary key, userid int not null comment '管理员ID', credential_id varchar(512) not null comment 'base64url编码的凭据ID', public_key text not null comment 'base64url编码的COSE公钥', sign_count bigint default 0 not null comment '签名计数器', backup_eligible int default 0 not null comment '是否支持备份 0否 1是', backup_state int default 0 not null comment '是否已备份 0否 1是', algorithm int not null comment '认证器算法 -7 ES256 / -257 RS256', device_name varchar(100) null comment '设备展示名称', aaguid varchar(64) null comment 'base64url编码的AAGUID', create_time bigint not null comment '创建时间戳(毫秒)', last_used_time bigint null comment '最近使用时间戳(毫秒)', unique index uk_sys_passkey_credential (credential_id), index idx_sys_passkey_userid (userid) ) comment '管理员Passkey凭据';" 1.3.4_5: 1: - "create table if not exists agent_trust ( id bigint auto_increment primary key, cluster_id varchar(64) not null comment '集群标识,同一套主控库共用', address varchar(128) not null comment '可信管理源地址(CIDR)', source varchar(16) not null comment '来源 local主控自报 probe节点实测', node_id int null comment '上报该地址的被控节点ID', create_time bigint not null comment '创建时间戳(毫秒)', last_seen bigint not null comment '最近一次上报时间戳(毫秒)', unique index uk_agent_trust_cluster_addr (cluster_id, address), index idx_agent_trust_seen (last_seen) ) comment '被控端可信管理源白名单';" 1.3.4_6: 1: - "alter table master add node_public_key text null comment '节点公钥(PEM证书),用于核对节点证书与有效期';" 1.3.4_7: 1: - "alter table master add public_ip_mode varchar(20) default 'legacy' not null comment 'VPC公网接入模式 legacy/routed/l2_alias/proxy_arp', add public_ip_interface varchar(64) null comment 'VPC公网接入物理网卡';" - "update master set public_ip_mode = 'legacy' where public_ip_mode is null or trim(public_ip_mode) = '';" - "alter table vpc_ip_binding add delivery_mode varchar(20) default 'legacy' not null comment '公网接入模式', add interface_name varchar(64) null comment '公网接入物理网卡', add address_installed int default 0 not null comment '是否由QAgent添加了公网地址', add route_installed int default 0 not null comment '是否由QAgent添加了公网路由', add last_check_time bigint null, add last_error varchar(1024) null;" - "update vpc_ip_binding set delivery_mode = 'legacy' where delivery_mode is null or trim(delivery_mode) = '';" 1.3.4_9: 1: - "alter table configuretemplate add vga varchar(20) null comment '显示设备类型(std/qxl/virtio等),决定VNC控制台默认分辨率';" - "alter table master add node_public_key text null comment '节点公钥(PEM证书),用于核对节点证书与有效期';" - "alter table master add public_ip_mode varchar(20) default 'legacy' not null comment 'VPC公网接入模式 legacy/routed/l2_alias/proxy_arp';" - "alter table master add public_ip_interface varchar(64) null comment 'VPC公网接入物理网卡';" - "alter table vpc_ip_binding add delivery_mode varchar(20) default 'legacy' not null comment '公网接入模式';" - "alter table vpc_ip_binding add interface_name varchar(64) null comment '公网接入物理网卡';" - "alter table vpc_ip_binding add address_installed int default 0 not null comment '是否由QAgent添加了公网地址';" - "alter table vpc_ip_binding add route_installed int default 0 not null comment '是否由QAgent添加了公网路由';" - "alter table vpc_ip_binding add last_check_time bigint null;" - "alter table vpc_ip_binding add last_error varchar(1024) null;"