-- 2023-10-24 添加深信服相关sql
INSERT INTO dictionary ("name", "value", "pid", "weight") VALUES ('Sangfor', 'SANGFOR', 558, 1);
INSERT INTO plugins("name", "code", "vendor_type", "gmt_create", "gmt_modify", "remark", "is_deleted", "status") VALUES ('Sangfor纳管', 'Sangfor-plugin', 'SANGFOR', '2022-09-08 10:10:00', '2022-09-08 10:46:17', 'Sangfor纳管', 0, 1);
-- 宿主机（物理机）
ALTER TABLE server  ADD COLUMN alert varchar(255) DEFAULT NULL;
comment on COLUMN server.alert is '是否有告警';
ALTER TABLE server  ADD COLUMN master int  DEFAULT NULL;
comment on COLUMN server.master is '是否主控';
ALTER TABLE server  ADD COLUMN type	  varchar(255) DEFAULT NULL;
comment on COLUMN server.type is '';
ALTER TABLE server  ADD COLUMN urgent int  DEFAULT NULL;
comment on COLUMN server.urgent is '';
ALTER TABLE server  ADD COLUMN cpu_ratio varchar(255) DEFAULT NULL;
comment on COLUMN server.cpu_ratio is 'cpu使用率';
ALTER TABLE server  ADD COLUMN mem_ratio varchar(255) DEFAULT NULL;
comment on COLUMN server.mem_ratio is '内存使用率';
ALTER TABLE server  ADD COLUMN io_ratio varchar(255) DEFAULT NULL;
comment on COLUMN server.io_ratio is 'IO使用率';
ALTER TABLE server  ADD COLUMN con_mem_ratio varchar(255) DEFAULT NULL;
comment on COLUMN server.con_mem_ratio is '配置内存使用率';
ALTER TABLE server  ADD COLUMN detail text DEFAULT NULL;
comment on COLUMN server.detail is '深信服主机详情';
-- 虚拟机
ALTER TABLE cloud_server  ADD COLUMN group_id varchar(255) DEFAULT NULL;
comment on COLUMN cloud_server.group_id is '分组id';
ALTER TABLE cloud_server  ADD COLUMN group_name varchar(255) DEFAULT NULL;
comment on COLUMN cloud_server.group_name is '分组名称';
ALTER TABLE cloud_server  ADD COLUMN detail text DEFAULT NULL;
comment on COLUMN cloud_server.detail is '深信服虚拟机详情';
-- 存储
ALTER TABLE data_store  ADD COLUMN free_rate varchar(255) DEFAULT NULL;
comment on column data_store.free_rate is '空闲率';
ALTER TABLE data_store  ADD COLUMN replica int DEFAULT NULL;
comment on column data_store.replica is '副本数';
ALTER TABLE data_store  ADD COLUMN io_read int DEFAULT NULL;
comment on column data_store.io_read is 'io读速率';
ALTER TABLE data_store  ADD COLUMN io_write int DEFAULT NULL;
comment on column data_store.io_write is 'io写速率';
ALTER TABLE data_store  ADD COLUMN sangfor_type varchar(255) DEFAULT NULL;
comment on column data_store.sangfor_type is '深信服存储类型';
ALTER TABLE data_store  ADD COLUMN ssd_remaining_life varchar(255) DEFAULT NULL;
comment on column data_store.ssd_remaining_life is 'SSD寿命剩余';
ALTER TABLE data_store  ADD COLUMN host_guid varchar(255) DEFAULT NULL;
comment on column data_store.host_guid is '所属物理机uuid';

-- 网络
ALTER TABLE network  ADD COLUMN group_id varchar(255) DEFAULT NULL;
comment on column network.group_id is '分组id';
ALTER TABLE network  ADD COLUMN group_name varchar(255) DEFAULT NULL;
comment on column network.group_name is '分组名称';
ALTER TABLE network  ADD COLUMN group_path varchar(255) DEFAULT NULL;
comment on column network.group_path is '分组路劲';
ALTER TABLE network  ADD COLUMN obj_count int DEFAULT NULL;
comment on column network.obj_count is '已连接网口数';
ALTER TABLE network  ADD COLUMN in_bps int DEFAULT NULL;
comment on column network.in_bps is '接收速率 bps int';
ALTER TABLE network  ADD COLUMN in_pps int DEFAULT NULL;
comment on column network.in_pps is '接收速率 pps';
ALTER TABLE network  ADD COLUMN out_bps int DEFAULT NULL;
comment on column network.out_bps is '发送速率 bps';
ALTER TABLE network  ADD COLUMN out_pps int DEFAULT NULL;
comment on column network.out_pps is '发送速率 pps';
ALTER TABLE network  ADD COLUMN ifs_amount int DEFAULT NULL;
comment on column network.ifs_amount is '所有网口数';
ALTER TABLE network  ADD COLUMN cfgstorage varchar(255) DEFAULT NULL;
comment on column network.cfgstorage is 'nfv 所在存储 id';
ALTER TABLE network  ADD COLUMN cpu_ratio varchar(255) DEFAULT NULL;
comment on column network.cpu_ratio is 'nfv CPU 使用率';
ALTER TABLE network  ADD COLUMN cpus int DEFAULT NULL;
comment on column network.cpus is 'nfv CPU 核数';
ALTER TABLE network  ADD COLUMN ha tinyint DEFAULT NULL;
comment on column network.ha is '是否启用故障迁移';
ALTER TABLE network  ADD COLUMN host varchar(255) DEFAULT NULL;
comment on column network.host is 'nfv 运行在的主机 id';
ALTER TABLE network  ADD COLUMN host_config varchar(255) DEFAULT NULL;
comment on column network.host_config is 'nfv 配置运行位置';
ALTER TABLE network  ADD COLUMN io_ratio varchar(255) DEFAULT NULL;
comment on column network.io_ratio is '磁盘容量使用率';
ALTER TABLE network  ADD COLUMN mem_ratio varchar(255) DEFAULT NULL;
comment on column network.mem_ratio is 'nfv 内存使用率';
ALTER TABLE network  ADD COLUMN mem_total int DEFAULT NULL;
comment on column network.mem_total is 'nfv 总内存';
ALTER TABLE network  ADD COLUMN mem_used int DEFAULT NULL;
comment on column network.mem_used is 'nfv 已使用内存';
ALTER TABLE network  ADD COLUMN mhz int DEFAULT NULL;
comment on column network.mhz is 'CPU 赫兹数';
ALTER TABLE network  ADD COLUMN policy varchar(255) DEFAULT NULL;
comment on column network.policy is '调度策略';
ALTER TABLE network  ADD COLUMN runarea varchar(255) DEFAULT NULL;
comment on column network.runarea is '指定故障域';
ALTER TABLE network  ADD COLUMN running varchar(255) DEFAULT NULL;
comment on column network.running is 'nfv 是否正在运行';
ALTER TABLE network  ADD COLUMN storagename varchar(255) DEFAULT NULL;
comment on column network.storagename is 'nfv 所在存储名称';

-- 深信服虚拟机操作日志
CREATE TABLE sangfor_server_log (
    id bigint NOT NULL AUTO_INCREMENT,
    object_type varchar(255) NULL DEFAULT NULL,
    event_id int NULL DEFAULT NULL,
    hostid varchar(255) NULL DEFAULT NULL,
    hostname varchar(255) NULL DEFAULT NULL,
    action_type int NULL DEFAULT NULL,
    "user" varchar(255) NULL DEFAULT NULL,
    object_id varchar(255) NULL DEFAULT NULL,
    risk_level int NULL DEFAULT NULL,
    process int NULL DEFAULT NULL,
    host varchar(255) NULL DEFAULT NULL,
    vm varchar(255) NULL DEFAULT NULL,
    alert_type varchar(255) NULL DEFAULT NULL,
    module_type int NULL DEFAULT NULL,
    "type" varchar(255) NULL DEFAULT NULL,
    object_name varchar(255) NULL DEFAULT NULL,
    "start" datetime NULL DEFAULT NULL,
    "end" datetime NULL DEFAULT NULL,
    vendor_id bigint NULL DEFAULT NULL,
    server_id bigint NULL DEFAULT NULL,
    guuid varchar(255) NULL DEFAULT NULL,
    gmt_create datetime NULL DEFAULT NULL,
    gmt_modify datetime NULL DEFAULT NULL,
    creator_id bigint NULL DEFAULT NULL,
    owner_id bigint NULL DEFAULT NULL,
    mender_id bigint NULL DEFAULT NULL,
    name varchar(255) NULL DEFAULT NULL,
    status varchar(255) NULL DEFAULT NULL,
    is_deleted tinyint NULL DEFAULT NULL,
    props varchar(255) NULL DEFAULT NULL,
    remark varchar(255) NULL DEFAULT NULL,
    constraint sangfor_server_log primary key (id)
);

CREATE TABLE "sangfor_iface"  (
    "id" bigint NOT NULL AUTO_INCREMENT,
    "vendor_id" bigint NULL DEFAULT NULL,
    "uuid" varchar(255)  NULL DEFAULT NULL,
    "name" varchar(255)  NULL DEFAULT NULL,
    "node_id" varchar(255)  NULL DEFAULT NULL,
    "node_name" varchar(255)  NULL DEFAULT NULL,
    "node_status" varchar(255)  NULL DEFAULT NULL,
    "channel_protection" int NULL DEFAULT NULL,
    "members" varchar(512)  NULL DEFAULT NULL,
    "driver_type" varchar(255)  NULL DEFAULT NULL,
    "supported_link_modes" varchar(255)  NULL DEFAULT NULL,
    "mode" varchar(255)  NULL DEFAULT NULL,
    "rate" int NULL DEFAULT NULL,
    "disasterRole" int NULL DEFAULT NULL,
    "remark" varchar(255)  NULL DEFAULT NULL,
    "mac" varchar(255)  NULL DEFAULT NULL,
    "mtu" varchar(255)  NULL DEFAULT NULL,
    "iface_mode" varchar(255)  NULL DEFAULT NULL,
    "link_mode" int NULL DEFAULT NULL,
    "type" varchar(255)  NULL DEFAULT NULL,
    "alias" varchar(255)  NULL DEFAULT NULL,
    "vxlan" varchar(255)  NULL DEFAULT NULL,
    "ip" varchar(255)  NULL DEFAULT NULL,
    "gateway" varchar(255)  NULL DEFAULT NULL,
    "status" varchar(255)  NULL DEFAULT NULL,
    "main" varchar(255)  NULL DEFAULT NULL,
    "speed" varchar(512)  NULL DEFAULT NULL,
    "netmask" varchar(255)  NULL DEFAULT NULL,
    "enable" tinyint NOT NULL,
    "bdrSwitch" varchar(255)  NULL DEFAULT NULL,
    "vs_used" tinyint NOT NULL,
    "support_speed" varchar(255)  NULL DEFAULT NULL,
    "is_deleted" tinyint NULL DEFAULT NULL,
    "role" varchar(255) NULL DEFAULT NULL,
    constraint sangfor_iface primary key (id)
);

-- 深信服云平台菜单-后续还需要新增其他子菜单  sxp:2022-10-13
INSERT INTO "permission" ("name", "remark", "parent_id", "gmt_create", "gmt_modify", "creator_id", "mender_id", "status", "is_deleted", "owner_id", "props", "path", "icon", "category", "priority", "is_tenant", "router", "component", "redirect", "meta", "params", "service_codes", "plugins_code", "plugins_status") VALUES ('深信服', NULL, 53, '2022-09-26 14:08:20', '2022-09-26 17:50:38', 16, 16, 'NORMAL', 0, NULL, NULL, 'sangfor', NULL, 'view', 42, 0, 'SANGFOR', 'vendorHeader', 'sangfor/vm', '[{"key":"vendorType","value":"SANGFOR"}]', '[]', NULL, 'Sangfor-plugin', 1);

-- delete from "permission" where "parent_id" = 11729;

INSERT INTO "permission" ("name", "remark", "parent_id", "gmt_create", "gmt_modify", "creator_id", "mender_id", "status", "is_deleted", "owner_id", "props", "path", "icon", "category", "priority", "is_tenant", "router", "component", "redirect", "meta", "params", "service_codes", "plugins_code", "plugins_status") VALUES ('虚拟机', NULL, 11729, '2022-09-26 15:13:29', '2022-09-28 15:10:22', 16, 16, 'NORMAL', 0, NULL, NULL, 'vm', NULL, 'menu', 1, 0, 'sangforVm', 'sangforVm', NULL, '[]', '[]', NULL, 'Sangfor-plugin', 1);
INSERT INTO "permission" ("name", "remark", "parent_id", "gmt_create", "gmt_modify", "creator_id", "mender_id", "status", "is_deleted", "owner_id", "props", "path", "icon", "category", "priority", "is_tenant", "router", "component", "redirect", "meta", "params", "service_codes", "plugins_code", "plugins_status") VALUES ('实体机', NULL, 11729, '2022-09-28 15:23:11', '2022-10-14 17:33:06', 16, 5, 'NORMAL', 0, NULL, NULL, 'host', NULL, 'menu', 2, 0, 'sangforHost', 'sangforHost', NULL, '[]', '[]', NULL, 'Sangfor-plugin', 1);
INSERT INTO "permission" ("name", "remark", "parent_id", "gmt_create", "gmt_modify", "creator_id", "mender_id", "status", "is_deleted", "owner_id", "props", "path", "icon", "category", "priority", "is_tenant", "router", "component", "redirect", "meta", "params", "service_codes", "plugins_code", "plugins_status") VALUES ('数据存储', NULL, 11729, '2022-09-28 15:23:43', '2022-09-28 15:23:43', 16, NULL, 'NORMAL', 0, NULL, NULL, 'storage', NULL, 'menu', 3, 0, 'sangforStorage', 'sangforStorage', NULL, '[]', '[]', NULL, 'Sangfor-plugin', 1);
INSERT INTO "permission" ("name", "remark", "parent_id", "gmt_create", "gmt_modify", "creator_id", "mender_id", "status", "is_deleted", "owner_id", "props", "path", "icon", "category", "priority", "is_tenant", "router", "component", "redirect", "meta", "params", "service_codes", "plugins_code", "plugins_status") VALUES ('虚拟网络', NULL, 11729, '2022-10-09 14:07:18', '2022-10-09 14:09:31', 6, 6, 'NORMAL', 0, NULL, NULL, 'network', NULL, 'menu', 4, 0, 'sangforNetwork', 'sangforNetwork', NULL, '[]', '[]', NULL, 'Sangfor-plugin', 1);
INSERT INTO "permission" ("name", "remark", "parent_id", "gmt_create", "gmt_modify", "creator_id", "mender_id", "status", "is_deleted", "owner_id", "props", "path", "icon", "category", "priority", "is_tenant", "router", "component", "redirect", "meta", "params", "service_codes", "plugins_code", "plugins_status") VALUES ('通信口', NULL, 11729, '2022-10-17 10:30:50', '2022-10-18 21:14:54', 6, 6, 'NORMAL', 1, NULL, NULL, 'port', NULL, 'menu', 5, 0, 'sangforPort', 'sangforPort', NULL, '[]', '[]', NULL, 'Sangfor-plugin', 1);
INSERT INTO "permission" ("name", "remark", "parent_id", "gmt_create", "gmt_modify", "creator_id", "mender_id", "status", "is_deleted", "owner_id", "props", "path", "icon", "category", "priority", "is_tenant", "router", "component", "redirect", "meta", "params", "service_codes", "plugins_code", "plugins_status") VALUES ('系统盘', NULL, 11729, '2022-10-17 14:07:24', '2022-10-18 21:14:41', 6, 6, 'NORMAL', 1, NULL, NULL, 'system_disk', NULL, 'menu', 6, 0, 'sangforSystemDisk', 'sangforSystemDisk', NULL, '[]', '[]', NULL, 'Sangfor-plugin', 1);
INSERT INTO "permission" ("name", "remark", "parent_id", "gmt_create", "gmt_modify", "creator_id", "mender_id", "status", "is_deleted", "owner_id", "props", "path", "icon", "category", "priority", "is_tenant", "router", "component", "redirect", "meta", "params", "service_codes", "plugins_code", "plugins_status") VALUES ('物理网络', NULL, 11729, '2022-10-17 14:22:55', '2022-10-18 21:15:15', 6, 6, 'NORMAL', 1, NULL, NULL, 'physical_network', NULL, 'menu', 7, 0, 'sangforPhysicalNetwork', 'sangforPhysicalNetwork', NULL, '[]', '[]', NULL, 'Sangfor-plugin', 1);
INSERT INTO "permission" ("name", "remark", "parent_id", "gmt_create", "gmt_modify", "creator_id", "mender_id", "status", "is_deleted", "owner_id", "props", "path", "icon", "category", "priority", "is_tenant", "router", "component", "redirect", "meta", "params", "service_codes", "plugins_code", "plugins_status") VALUES ('防火墙', NULL, 11729, '2022-10-26 10:16:28', '2022-10-26 10:16:28', 6, NULL, 'NORMAL', 0, NULL, NULL, 'firewall', NULL, 'menu', 5, 0, 'sangforFirewall', 'sangforFirewall', NULL, '[]', '[]', NULL, 'Sangfor-plugin', 1);

-- 防火墙新增字段
ALTER TABLE firewall_rule  ADD COLUMN  priority int  DEFAULT NULL;
comment on column firewall_rule.priority is '优先级';
ALTER TABLE firewall_rule  ADD COLUMN  fw_index int  DEFAULT NULL;
ALTER TABLE firewall_rule  ADD COLUMN  is_default tinyint DEFAULT NULL;
comment on column firewall_rule.is_default is '是否默认策略';
ALTER TABLE firewall_rule  ADD COLUMN  srv text DEFAULT NULL;
comment on column firewall_rule.srv is '服务';
ALTER TABLE firewall_rule  ADD COLUMN  fw_range varchar(255) DEFAULT NULL;
ALTER TABLE firewall_rule  ADD COLUMN  srcip text DEFAULT NULL;
comment on column firewall_rule.srcip is '源ip';
ALTER TABLE firewall_rule  ADD COLUMN  dstip text DEFAULT NULL;
comment on column firewall_rule.dstip is '目的ip';
ALTER TABLE firewall_rule  ADD COLUMN  src_type varchar(255) DEFAULT NULL;
comment on column firewall_rule.src_type is '源类型';
ALTER TABLE firewall_rule  ADD COLUMN  dst_type varchar(255) DEFAULT NULL;
comment on column firewall_rule.dst_type is '目的类型';
ALTER TABLE firewall_rule  ADD COLUMN  srcif_all int DEFAULT NULL;
ALTER TABLE firewall_rule  ADD COLUMN  dstif_all int DEFAULT NULL;

-- 公有云账单系数
alter table cloud_vendor add column bill_factor decimal(4,2) default 1 ;
comment on column cloud_vendor.bill_factor is '账单系数';
alter table cloud_bill add column original_money decimal(10, 3) ;
comment on column cloud_bill.original_money is '账单原价格';

-- 负载均衡新增字段
ALTER TABLE "lb_listener_rule" ADD COLUMN "listener_id" BIGINT DEFAULT NULL;
comment on column lb_listener_rule.listener_id is '监听器id';

-- 深信服虚拟机分组
CREATE TABLE "sangfor_server_group"  (
    "id" bigint NOT NULL AUTO_INCREMENT,
    "gmt_create" datetime NULL DEFAULT NULL,
    "gmt_modify" datetime NULL DEFAULT NULL,
    "creator_id" bigint NULL DEFAULT NULL,
    "owner_id" bigint NULL DEFAULT NULL,
    "mender_id" bigint NULL DEFAULT NULL,
    "name" varchar(255)  NULL DEFAULT NULL,
    "status" varchar(255)  NULL DEFAULT NULL,
    "is_deleted" tinyint NULL DEFAULT NULL,
    "props" varchar(255)  NULL DEFAULT NULL,
    "remark" varchar(255)  NULL DEFAULT NULL,
    "vendor_id" bigint NULL DEFAULT NULL,
    "uuid" varchar(255)  NULL DEFAULT NULL,
    "type" varchar(255)  NULL DEFAULT NULL,
    "path" varchar(255)  NULL DEFAULT NULL,
    "owner" varchar(255)  NULL DEFAULT NULL,
    constraint sangfor_server_group primary key (id)
);

CREATE TABLE "sangfor_bridge_info"  (
    "id" bigint NOT NULL AUTO_INCREMENT,
    "gmt_create" datetime NULL DEFAULT NULL,
    "gmt_modify" datetime NULL DEFAULT NULL,
    "creator_id" bigint NULL DEFAULT NULL,
    "owner_id" bigint NULL DEFAULT NULL,
    "mender_id" bigint NULL DEFAULT NULL,
    "name" varchar(255)  NULL DEFAULT NULL,
    "status" varchar(255)  NULL DEFAULT NULL,
    "is_deleted" tinyint NULL DEFAULT NULL,
    "props" varchar(255)  NULL DEFAULT NULL,
    "remark" varchar(255)  NULL DEFAULT NULL,
    "vendor_id" bigint NULL DEFAULT NULL,
    "uuid" varchar(255)  NULL DEFAULT NULL,
    "assemble_uuid" varchar(255)  NULL DEFAULT NULL,
    "network_id" bigint NULL DEFAULT NULL,
    "network_uuid" varchar(255)  NULL DEFAULT NULL,
    "address" varchar(255)  NULL DEFAULT NULL,
    "hostid" varchar(255)  NULL DEFAULT NULL,
    "hostname" varchar(255)  NULL DEFAULT NULL,
    "local_vlink_name" varchar(255)  NULL DEFAULT NULL,
    "type" varchar(255)  NULL DEFAULT NULL,
    "hoststatus" int NULL DEFAULT NULL,
    "in_bps" int NULL DEFAULT NULL,
    "in_pps" int NULL DEFAULT NULL,
    "out_bps" int NULL DEFAULT NULL,
    "out_pps" int NULL DEFAULT NULL,
    "up" tinyint NULL DEFAULT NULL,
    constraint sangfor_bridge_info primary key (id)
);

CREATE TABLE "sangfor_vlan_group"  (
   "id" bigint NOT NULL AUTO_INCREMENT,
   "gmt_create" datetime NULL DEFAULT NULL,
   "gmt_modify" datetime NULL DEFAULT NULL,
   "creator_id" bigint NULL DEFAULT NULL,
   "owner_id" bigint NULL DEFAULT NULL,
   "mender_id" bigint NULL DEFAULT NULL,
   "name" varchar(255)  NULL DEFAULT NULL,
   "status" varchar(255)  NULL DEFAULT NULL,
   "is_deleted" tinyint NULL DEFAULT NULL,
   "props" varchar(255)  NULL DEFAULT NULL,
   "remark" varchar(255)  NULL DEFAULT NULL,
   "vendor_id" bigint NULL DEFAULT NULL,
   "uuid" varchar(255)  NULL DEFAULT NULL,
   "assemble_uuid" varchar(255)  NULL DEFAULT NULL,
   "network_id" bigint NULL DEFAULT NULL,
   "network_uuid" varchar(255)  NULL DEFAULT NULL,
   "trunk_vlanid" varchar(255)  NULL DEFAULT NULL,
   "type" varchar(255)  NULL DEFAULT NULL,
   "count" int NULL DEFAULT NULL,
   "native_vlanid" int NULL DEFAULT NULL,
   "is_default" tinyint NULL DEFAULT NULL,
   constraint sangfor_vlan_group primary key (id)
);

-- 公有云账单增加项目名称字段  sxp:2022-12-12
ALTER TABLE "cloud_bill"
    ADD COLUMN "project_name" VARCHAR(255) NULL DEFAULT NULL;

-- 存储卷添加存储策略
ALTER TABLE volume  ADD COLUMN  disk_policie_uuid varchar(255) DEFAULT NULL;
comment on column volume.disk_policie_uuid is '存储策略uuid';
ALTER TABLE volume  ADD COLUMN  disk_policie_name varchar(255) DEFAULT NULL;
comment on column volume.disk_policie_name is '存储策略名称';

-- server深信服V6.8新增字段
alter table "server" add COLUMN "sangfor_az_id" VARCHAR(255);
alter table "server" add COLUMN "memory" VARCHAR(255);
alter table "server" add COLUMN "disk" VARCHAR(255);
alter table "server" add COLUMN "socket_count" BIGINT;
alter table "server" add COLUMN "cpu_core" BIGINT;
alter table "server" add COLUMN "used_cpu" VARCHAR(255);
alter table "server" add COLUMN "used_memory" VARCHAR(255);
alter table "server" add COLUMN "cpu_total_mhz" VARCHAR(255);

-- 深信服V6.8新增通信口数据表
CREATE TABLE "sangfor_communication"  (
    "id" bigint NOT NULL AUTO_INCREMENT,
    "ifaces" varchar(255)  NULL DEFAULT NULL,
    "ip" varchar(255)  NULL DEFAULT NULL,
    "netmask" varchar(255)  NULL DEFAULT NULL,
    "vendor_id" bigint NULL DEFAULT NULL,
    "gmt_create" datetime NULL DEFAULT NULL,
    "gmt_modify" datetime NULL DEFAULT NULL,
    "creator_id" bigint NULL DEFAULT NULL,
    "owner_id" bigint NULL DEFAULT NULL,
    "mender_id" bigint NULL DEFAULT NULL,
    "name" varchar(255)  NULL DEFAULT NULL,
    "status" varchar(255)  NULL DEFAULT NULL,
    "is_deleted" tinyint NULL DEFAULT NULL,
    "props" varchar(255)  NULL DEFAULT NULL,
    "remark" varchar(255)  NULL DEFAULT NULL,
    "interface_id" varchar(255)  NULL DEFAULT NULL,
    constraint sangfor_communication primary key (id)
);

-- 深信服 Storage表V6.8新增字段
alter table "storage" add COLUMN "online_status" BIGINT;
alter table "storage" add COLUMN "ssd_remaining_life" VARCHAR(255);
alter table "storage" add COLUMN "is_sangfor_system_disk" VARCHAR(255);
alter table "storage" add COLUMN "storage_tag_id" VARCHAR(255);
alter table "storage" add COLUMN "storage_tag_name" VARCHAR(255);
alter table "storage" add COLUMN "storage_label" VARCHAR(255);
alter table "storage" add COLUMN "cluster_id" VARCHAR(255);
alter table "storage" add COLUMN "cluster_name" VARCHAR(255);
alter table "storage" add COLUMN "cluster_type" VARCHAR(255);
alter table "storage" add COLUMN "az_id" VARCHAR(255);
alter table "storage" add COLUMN "target" BIGINT;
alter table "storage" add COLUMN "total_mb" BIGINT;
alter table "storage" add COLUMN "used_mb" BIGINT;
alter table "storage" add COLUMN "ratio" VARCHAR(255);

-- 深信服V6.8 sangfor_server_group表新增字段
alter table "sangfor_server_group" add COLUMN "cloud_type" VARCHAR(255);
alter table "sangfor_server_group" add COLUMN "parent_id" VARCHAR(255);
alter table "sangfor_server_group" add COLUMN "platform_type" VARCHAR(255);
alter table "sangfor_server_group" add COLUMN "project_id" VARCHAR(255);
alter table "sangfor_server_group" add COLUMN "group_type" VARCHAR(255);
alter table "sangfor_server_group" add COLUMN "az_id" VARCHAR(255);

-- 深信服V6.9 network 表新增字段
alter table "network" add COLUMN "az_id" VARCHAR(255);
alter table "network" add COLUMN "enable" BIGINT;
alter table "network" add COLUMN "net_work_type" VARCHAR(255);

-- 深信服V6.8 sangfor_vlan_group表新增字段
alter table "sangfor_vlan_group" add COLUMN "vlan_id" VARCHAR(255);
alter table "sangfor_vlan_group" add COLUMN "pv_id" BIGINT;
alter table "sangfor_vlan_group" add COLUMN "vlan_range" VARCHAR(255);

-- 深信服V6.8 sangfor_bridge_info表新增字段
alter table "sangfor_bridge_info" add COLUMN "prot_uuid" VARCHAR(255);
alter table "sangfor_bridge_info" add COLUMN "vlan_id" VARCHAR(255);

-- 深信服V6.8 cloud_server 新增字段
alter table "cloud_server" add COLUMN "sockets" INT;
alter table "cloud_server" add COLUMN "storage_location" VARCHAR(255);

-- 深信服V6.8 firewall_rule表字段新增
alter table "firewall_rule" add COLUMN "policy_type" VARCHAR(255);
alter table "firewall_rule" add COLUMN "sangfor_project_id" VARCHAR(255);
alter table "firewall_rule" add COLUMN "az_id" VARCHAR(255);
alter table "firewall_rule" add COLUMN "rule_ids" VARCHAR(255);
alter table "firewall_rule" add COLUMN "network_type" VARCHAR(255);
alter table "firewall_rule" add COLUMN "sangfor_policy_id" VARCHAR(255);
alter table "firewall_rule" add COLUMN "vpc_id" VARCHAR(255);

-- 通信口
alter table "sangfor_communication" add COLUMN "speed" VARCHAR(255);
alter table "sangfor_communication" add COLUMN "node_members" VARCHAR(255);
alter table "sangfor_communication" add COLUMN "node_name" VARCHAR(255);
alter table "sangfor_communication" add COLUMN "node_id" VARCHAR(255);
alter table "sangfor_communication" add COLUMN "gateway" VARCHAR(255);
alter table "sangfor_communication" add COLUMN "driver_type" VARCHAR(255);
alter table "sangfor_communication" add COLUMN "enable" TINYINT;
alter table "sangfor_communication" add COLUMN "primarys" VARCHAR(255);

--深信服资源池列表
CREATE TABLE "sangfor_az"  (
    "id" bigint NOT NULL AUTO_INCREMENT,
    "description" varchar(255)  NULL DEFAULT NULL,
    "tag" varchar(255)  NULL DEFAULT NULL,
    "uuid" varchar(255)  NULL DEFAULT NULL,
    "type" varchar(255)  NULL DEFAULT NULL,
    "version" varchar(255)  NULL DEFAULT NULL,
    "gmt_create" datetime NULL DEFAULT NULL,
    "gmt_modify" datetime NULL DEFAULT NULL,
    "creator_id" bigint NULL DEFAULT NULL,
    "owner_id" bigint NULL DEFAULT NULL,
    "mender_id" bigint NULL DEFAULT NULL,
    "name" varchar(255)  NULL DEFAULT NULL,
    "status" varchar(255)  NULL DEFAULT NULL,
    "is_deleted" tinyint NULL DEFAULT NULL,
    "props" varchar(255)  NULL DEFAULT NULL,
    "remark" varchar(255)  NULL DEFAULT NULL,
    "vendor_id" bigint NULL DEFAULT NULL,
    constraint sangfor_az primary key (id)
);

--深信服V6.8通信口新增字段
alter table "sangfor_communication" add COLUMN "node_status" TINYINT;
alter table "sangfor_communication" add COLUMN "member" VARCHAR(255);
alter table "sangfor_communication" add COLUMN "host_alias" VARCHAR(255);
alter table "sangfor_communication" add COLUMN "host_ip" VARCHAR(255);
alter table "sangfor_communication" add COLUMN "subdatas" TEXT;
alter table "sangfor_communication" add COLUMN "bdr_switch" VARCHAR(255);
alter table "sangfor_communication" add COLUMN "custom_id" BIGINT;
alter table "sangfor_communication" add COLUMN "mtu" VARCHAR(255);
alter table "storage" add COLUMN "sangfor_type" VARCHAR(255);
alter table "storage" add COLUMN "guid" VARCHAR(255);

-- 深信服V6.8用户列表新增表
CREATE TABLE "sangfor_project"  (
    "id" bigint NOT NULL AUTO_INCREMENT,
    "uuid" varchar(255)  NULL DEFAULT NULL,
    "name" varchar(255)  NULL DEFAULT NULL,
    "enabled" varchar(255)  NULL DEFAULT NULL,
    "role_type" varchar(255)  NULL DEFAULT NULL,
    "vendor_id" bigint NULL DEFAULT NULL,
    "gmt_create" datetime NULL DEFAULT NULL,
    "gmt_modify" datetime NULL DEFAULT NULL,
    "creator_id" bigint NULL DEFAULT NULL,
    "owner_id" bigint NULL DEFAULT NULL,
    "mender_id" bigint NULL DEFAULT NULL,
    "status" varchar(255)  NULL DEFAULT NULL,
    "is_deleted" tinyint NULL DEFAULT NULL,
    "props" varchar(255)  NULL DEFAULT NULL,
    "remark" varchar(255)  NULL DEFAULT NULL,
    constraint sangfor_project primary key (id)
);

-- 云平台相关表增加az_uuid字段  sxp:2023.5.31
ALTER TABLE "cloud_server"
    ADD COLUMN "az_uuid" VARCHAR(64) NULL DEFAULT NULL;

ALTER TABLE "server"
    ADD COLUMN "az_uuid" VARCHAR(64) NULL DEFAULT NULL;
ALTER TABLE "data_store"
    ADD COLUMN "az_uuid" VARCHAR(64) NULL DEFAULT NULL;
ALTER TABLE "port_group"
    ADD COLUMN "vlan_uuid" VARCHAR(256) NULL DEFAULT NULL;

-- image表新增镜像格式字段 why:2023.6.20
ALTER TABLE "image"
    ADD COLUMN "sangfor_image_format" VARCHAR(256) NULL DEFAULT NULL;

-- 开发少整理升级语句  sxp:2023-6-25
ALTER TABLE "port"
    ADD COLUMN "host_id" VARCHAR(255) NULL DEFAULT NULL;
ALTER TABLE "port"
    ADD COLUMN "vlan_id" VARCHAR(255) NULL DEFAULT NULL;
ALTER TABLE "port"
    ADD COLUMN "type"  VARCHAR(255) NULL DEFAULT NULL;

-- 服务目录增加字段【高级设置】
ALTER TABLE "cloud_service"
    ADD COLUMN "advanced_settings" TINYINT NULL DEFAULT 0;
ALTER TABLE "service_flow_config"
    ADD COLUMN "advanced_flow_id" TEXT NULL;

alter table business add business_type VARCHAR(255);
alter table snapshot add disks TEXT;
alter table snapshot add snap_object TEXT;
alter table snapshot add is_protected TINYINT;
alter table snapshot add powerstatus TINYINT;

alter table department add code VARCHAR(200);
alter table department add manager_emp_no VARCHAR(200);
alter table department add fg_emp_no VARCHAR(200);
alter table department add manager_emp_id BIGINT;
alter table department add fg_emp_id BIGINT;
alter table department add is_network_depart TINYINT;

-- 镜像增加字段
ALTER TABLE "image"
    ADD COLUMN "detail" TEXT NULL;


alter table POOL_GROUP add AZ_UUID varchar(50);
alter table POOL_GROUP add GROUP_ID bigint(10);

ALTER TABLE "image" ADD COLUMN "az_uuid" VARCHAR(100) NULL;