SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for ne_info
-- ----------------------------
CREATE TABLE IF NOT EXISTS `ne_info`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `rm_uid` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '',
  `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '',
  `ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '',
  `port` int NULL DEFAULT 0 COMMENT '端口',
  `pv_flag` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'PNF' COMMENT '\'PNF\',\'VNF\'',
  `province` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '-' COMMENT '省份地域',
  `vendor_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '-',
  `dn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '',
  `ne_address` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'MAC地址',
  `host_ids` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '网元主机ID组 数据格式(ssh,telnet,telnet)',
  `status` int NULL DEFAULT 0 COMMENT '0离线 1在线 2配置待下发',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` bigint NULL DEFAULT 0 COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` bigint NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `ux_netype_neid`(`ne_type` ASC, `ne_id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '网元信息表 对应一个网元版本、网元授权、网元主机' ROW_FORMAT = DYNAMIC;

-- 20240511前旧表更新
ALTER TABLE `ne_info` COMMENT = '网元信息表 对应一个网元版本、网元授权、网元主机';
ALTER TABLE `ne_info` ADD COLUMN IF NOT EXISTS `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注' AFTER `status`;
ALTER TABLE `ne_info` ADD COLUMN IF NOT EXISTS `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者' AFTER `remark`;
ALTER TABLE `ne_info` ADD COLUMN IF NOT EXISTS `create_time` bigint NULL DEFAULT 0 COMMENT '创建时间' AFTER `create_by`;
ALTER TABLE `ne_info` ADD COLUMN IF NOT EXISTS `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者' AFTER `create_time`;
ALTER TABLE `ne_info` MODIFY COLUMN `pv_flag` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'PNF' COMMENT '\'PNF\',\'VNF\'' AFTER `port`;
ALTER TABLE `ne_info` MODIFY COLUMN `province` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '省份地域' AFTER `pv_flag`;
ALTER TABLE `ne_info` MODIFY COLUMN `ne_address` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'MAC地址' AFTER `dn`;
ALTER TABLE `ne_info` MODIFY COLUMN `host_ids` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '网元主机ID组 数据格式(ssh,telnet,telnet)' AFTER `ne_address`;
ALTER TABLE `ne_info` MODIFY COLUMN `status` int NULL DEFAULT 0 COMMENT '0离线 1在线 2配置待下发' AFTER `host_ids`;
ALTER TABLE `ne_info` MODIFY COLUMN `update_time` bigint NULL DEFAULT 0 COMMENT '更新时间' AFTER `update_by`;

SET FOREIGN_KEY_CHECKS=1;
