SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for ne_license
-- ----------------------------
CREATE TABLE IF NOT EXISTS `ne_license`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型',
  `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID',
  `activation_request_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '激活申请代码',
  `license_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '激活授权文件',
  `serial_num` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '序列号',
  `expiry_date` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '许可证到期日期',
  `status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态 0无效 1有效',
  `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 `uk_type_id`(`ne_type` ASC, `ne_id` ASC) USING BTREE COMMENT '唯一网元类型和网元ID'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '网元授权激活信息' ROW_FORMAT = DYNAMIC;

-- 20240511前旧表更新
ALTER TABLE `ne_license` COMMENT = '网元授权激活信息';
ALTER TABLE `ne_license` ADD COLUMN `activation_request_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '激活申请代码' AFTER `ne_id`;
ALTER TABLE `ne_license` ADD COLUMN `license_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '激活授权文件' AFTER `activation_request_code`;
ALTER TABLE `ne_license` ADD COLUMN `serial_num` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '序列号' AFTER `license_path`;
ALTER TABLE `ne_license` ADD COLUMN `expiry_date` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '许可证到期日期' AFTER `serial_num`;
ALTER TABLE `ne_license` ADD COLUMN `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注' AFTER `status`;
ALTER TABLE `ne_license` ADD COLUMN `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者' AFTER `remark`;
ALTER TABLE `ne_license` ADD COLUMN `create_time` bigint NULL DEFAULT 0 COMMENT '创建时间' AFTER `create_by`;
ALTER TABLE `ne_license` ADD COLUMN `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者' AFTER `create_time`;
ALTER TABLE `ne_license` ADD COLUMN `update_time` bigint NULL DEFAULT 0 COMMENT '更新时间' AFTER `update_by`;
ALTER TABLE `ne_license` MODIFY COLUMN `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型' AFTER `id`;
ALTER TABLE `ne_license` MODIFY COLUMN `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID' AFTER `ne_type`;
ALTER TABLE `ne_license` MODIFY COLUMN `status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态 0无效 1有效' AFTER `expiry_date`;
ALTER TABLE `ne_license` DROP COLUMN `serial_no`;
ALTER TABLE `ne_license` DROP COLUMN `capcity`;
ALTER TABLE `ne_license` DROP COLUMN `used`;
ALTER TABLE `ne_license` DROP COLUMN `feature_enabled`;
ALTER TABLE `ne_license` DROP COLUMN `expiration_date`;
ALTER TABLE `ne_license` DROP COLUMN `path`;
ALTER TABLE `ne_license` DROP COLUMN `file_name`;
ALTER TABLE `ne_license` DROP COLUMN `comment`;
ALTER TABLE `ne_license` DROP COLUMN `created_at`;
ALTER TABLE `ne_license` DROP COLUMN `updated_at`;
ALTER TABLE `ne_license` DROP COLUMN `deleted_at`;
ALTER TABLE `ne_license` ADD UNIQUE INDEX `uk_type_id`(`ne_type` ASC, `ne_id` ASC) USING BTREE COMMENT '唯一网元类型和网元ID';


SET FOREIGN_KEY_CHECKS=1;
