Browse Source

update sql

tags/v2.0
之江天枢 4 years ago
parent
commit
57ab11e7f5
7 changed files with 3342 additions and 1621 deletions
  1. +0
    -1
      dubhe-server/admin/src/main/java/org/dubhe/admin/rest/DictController.java
  2. +0
    -1
      dubhe-server/admin/src/main/java/org/dubhe/admin/rest/DictDetailController.java
  3. +2
    -0
      dubhe-server/dubhe-serving/src/main/java/org/dubhe/serving/service/impl/BatchServingServiceImpl.java
  4. +60
    -71
      dubhe-server/sql/01-Dubhe-DDL.sql
  5. +126
    -311
      dubhe-server/sql/02-Dubhe-DML.sql
  6. +0
    -682
      dubhe-server/sql/09-Dubhe-Patch.sql
  7. +3154
    -555
      dubhe-server/sql/10-Dubhe-Boot-Update-Cloud.sql

+ 0
- 1
dubhe-server/admin/src/main/java/org/dubhe/admin/rest/DictController.java View File

@@ -101,7 +101,6 @@ public class DictController {

@ApiOperation("根据名称查询字典详情")
@GetMapping(value = "/{name}")
@PreAuthorize(Permissions.DICT)
public DataResponseBody getDict(@PathVariable String name) {
return DataResponseFactory.success(dictService.findByName(name));
}


+ 0
- 1
dubhe-server/admin/src/main/java/org/dubhe/admin/rest/DictDetailController.java View File

@@ -88,7 +88,6 @@ public class DictDetailController {

@ApiOperation("根据名称查询字典详情")
@GetMapping("/getDictDetails")
@PreAuthorize(Permissions.DICT)
public DataResponseBody<List<DictDetailVO>> findDictDetailByName(@Validated DictDetailQueryByLabelNameDTO dictDetailQueryByLabelNameDTO) {
return new DataResponseBody(dictDetailService.getDictName(dictDetailQueryByLabelNameDTO));
}


+ 2
- 0
dubhe-server/dubhe-serving/src/main/java/org/dubhe/serving/service/impl/BatchServingServiceImpl.java View File

@@ -394,6 +394,7 @@ public class BatchServingServiceImpl extends ServiceImpl<BatchServingMapper, Bat
}
BatchServing batchServing = checkBatchServingExist(batchServingUpdateDTO.getId(), user.getId());
checkBatchServingStatus(batchServing.getStatus());
batchServing.setStatusDetail(SymbolConstant.BRACKETS);
deployServingAsyncTask.deleteBatchServing(user, batchServing, batchServing.getResourceInfo());
//修改输入路径时,定时删除之前路径下的文件
if (!batchServing.getInputPath().equals(batchServingUpdateDTO.getInputPath())) {
@@ -794,6 +795,7 @@ public class BatchServingServiceImpl extends ServiceImpl<BatchServingMapper, Bat
.name(batchServing.getName())
.description(batchServing.getDescription())
.status(batchServing.getStatus())
.statusDetail(batchServing.getStatusDetail())
.progress(progress)
.startTime(batchServing.getStartTime())
.endTime(batchServing.getEndTime())


+ 60
- 71
dubhe-server/sql/01-Dubhe-DDL.sql View File

@@ -1,34 +1,34 @@
-- DDL 脚本
use dubhe-cloud-prod;
use `dubhe-cloud-prod`;

-- 原boot单体项目 DDL 脚本内容
CREATE TABLE IF NOT EXISTS `data_dataset` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '类型 0: private 私有数据, 1:team 团队数据 2:public 公开数据',
`team_id` bigint(20) NULL DEFAULT NULL,
`uri` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '数据集存储位置',
`create_user_id` bigint(20) NULL DEFAULT NULL,
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_user_id` bigint(20) NULL DEFAULT NULL,
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0),
`deleted` bit(1) NULL DEFAULT NULL,
`data_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '数据类型:0图片,1视频,2文本',
`annotate_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '标注类型:2分类,1目标检测,5目标跟踪',
`labels` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '标签集合,以逗号分隔',
`status` int(11) NOT NULL DEFAULT 0 COMMENT '101:未标注 102:手动标注中 103:自动标注中 104:自动标注完成 105:标注完成 201:目标跟踪中 202:目标跟踪完成 203:目标跟踪失败 301:未采样 302:采样中 303:采样失败 401:增强中 402:导入中',
`current_version_name` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前版本号',
`is_import` tinyint(1) NULL DEFAULT 0 COMMENT '是否用户导入',
`archive_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户导入数据集压缩包地址',
`decompress_state` tinyint(2) NULL DEFAULT 0 COMMENT '解压状态: 0未解压 1解压中 2解压完成 3解压失败',
`decompress_fail_reason` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '解压失败原因',
`is_top` tinyint(1) NULL DEFAULT NULL COMMENT '是否为置顶',
`origin_user_id` bigint(20) NULL DEFAULT NULL COMMENT '资源拥有人id',
`label_group_id` bigint(20) NULL DEFAULT NULL COMMENT '标签组ID',
`source_id` bigint(20) NULL DEFAULT NULL COMMENT '数据集源ID',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '数据集管理' ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `data_dataset` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`remark` varchar(255) DEFAULT NULL,
`type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类型 0: private 私有数据, 1:team 团队数据 2:public 公开数据',
`team_id` bigint(20) DEFAULT NULL,
`uri` varchar(255) DEFAULT '' COMMENT '数据集存储位置',
`create_user_id` bigint(20) DEFAULT NULL,
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_user_id` bigint(20) DEFAULT NULL,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT NULL,
`data_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '数据类型:0图片,1视频,2文本',
`annotate_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '标注类型:2分类,1目标检测,5目标跟踪',
`labels` varchar(255) NOT NULL DEFAULT '' COMMENT '标签集合,以逗号分隔',
`status` int(11) NOT NULL DEFAULT '0' COMMENT '101:未标注 102:手动标注中 103:自动标注中 104:自动标注完成 105:标注完成 201:目标跟踪中 202:目标跟踪完成 203:目标跟踪失败 301:未采样 302:采样中 303:采样失败 401:增强中 402:导入中',
`current_version_name` varchar(16) DEFAULT NULL COMMENT '当前版本号',
`is_import` tinyint(1) DEFAULT '0' COMMENT '是否用户导入',
`archive_url` varchar(255) DEFAULT NULL COMMENT '用户导入数据集压缩包地址',
`decompress_state` tinyint(2) DEFAULT '0' COMMENT '解压状态: 0未解压 1解压中 2解压完成 3解压失败',
`decompress_fail_reason` varchar(255) DEFAULT NULL COMMENT '解压失败原因',
`is_top` tinyint(1) DEFAULT NULL COMMENT '是否为置顶',
`origin_user_id` bigint(20) DEFAULT NULL COMMENT '资源拥有人id',
`label_group_id` bigint(20) DEFAULT NULL COMMENT '标签组ID',
`source_id` bigint(20) DEFAULT NULL COMMENT '数据集源ID',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT = 1 COMMENT='数据集管理';

CREATE TABLE IF NOT EXISTS `data_dataset_label` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -41,27 +41,27 @@ CREATE TABLE IF NOT EXISTS `data_dataset_label` (
`update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '修改人id',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `dataset_id`(`dataset_id`, `label_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `data_dataset_version` (
`id` bigint(19) NOT NULL AUTO_INCREMENT COMMENT '主键',
`dataset_id` bigint(19) NULL DEFAULT NULL COMMENT '数据集ID',
`team_id` bigint(19) NULL DEFAULT NULL COMMENT '团队ID',
`create_user_id` bigint(19) NULL DEFAULT NULL COMMENT '创建人',
`create_time` datetime(0) NOT NULL COMMENT '创建时间',
`update_user_id` bigint(19) NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '数据集版本删除标记0正常,1已删除',
`version_name` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '版本号',
`version_note` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '版本说明',
`version_source` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源版本号',
`version_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '版本信息存储url',
`data_conversion` int(1) NOT NULL DEFAULT 0 COMMENT '数据转换;0:图片未复制;1:未转换;2:已转换;3:无法转换; 4:标注未复制',
`origin_user_id` bigint(19) NULL DEFAULT 0 COMMENT '资源拥有人id',
`of_record` tinyint(1) NULL DEFAULT 0 COMMENT '是否生成ofRecord文件',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `unique_version`(`dataset_id`, `version_name`) USING BTREE COMMENT '数据集版本号唯一'
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8mb4_general_ci COMMENT = '数据集版本表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT='数据集标签';
CREATE TABLE IF NOT EXISTS `data_dataset_version` (
`id` bigint(19) NOT NULL AUTO_INCREMENT COMMENT '主键',
`dataset_id` bigint(19) DEFAULT NULL COMMENT '数据集ID',
`team_id` bigint(19) DEFAULT NULL COMMENT '团队ID',
`create_user_id` bigint(19) DEFAULT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_user_id` bigint(19) DEFAULT NULL COMMENT '修改人',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '数据集版本删除标记0正常,1已删除',
`version_name` varchar(8) NOT NULL COMMENT '版本号',
`version_note` varchar(50) NOT NULL COMMENT '版本说明',
`version_source` varchar(32) DEFAULT NULL COMMENT '来源版本号',
`version_url` varchar(255) DEFAULT NULL COMMENT '版本信息存储url',
`data_conversion` int(1) NOT NULL DEFAULT '0' COMMENT '数据转换;0:未复制;1:已复制;2:转换完成,3:转换失败',
`origin_user_id` bigint(20) DEFAULT NULL COMMENT '资源用有人ID',
`of_record` tinyint(1) DEFAULT '0' COMMENT '是否生成ofRecord文件',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `unique_version` (`dataset_id`,`version_name`) COMMENT '数据集版本号唯一'
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='数据集版本表';

CREATE TABLE IF NOT EXISTS `data_dataset_version_file` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
@@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS `data_dataset_version_file` (
KEY `dataset_id_annotation_status` (`dataset_id`,`annotation_status`,`version_name`) USING BTREE,
KEY `select_file` (`dataset_id`,`status`,`annotation_status`,`version_name`,`file_id`),
KEY `file_state_annotation_finished` (`dataset_id`,`file_id`,`version_name`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='数据集版本文件关系表';
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='数据集版本文件关系表';

CREATE TABLE IF NOT EXISTS `data_file` (
`id` bigint(20) unsigned zerofill NOT NULL AUTO_INCREMENT COMMENT 'ID',
@@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS `data_file` (
KEY `uuid` (`url`,`deleted`) USING BTREE,
KEY `status` (`dataset_id`,`status`,`deleted`) USING BTREE,
KEY `es_transport` (`es_transport`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文件信息';
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='文件信息';

CREATE TABLE IF NOT EXISTS `data_file_annotation` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -126,7 +126,7 @@ CREATE TABLE IF NOT EXISTS `data_file_annotation` (
PRIMARY KEY (`id`),
KEY `version_file_index` (`version_file_id`) USING BTREE,
KEY `label_dataset_id_index` (`label_id`,`dataset_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='数据集文件标注表';
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='数据集文件标注表';

CREATE TABLE IF NOT EXISTS `data_group_label` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -138,7 +138,7 @@ CREATE TABLE IF NOT EXISTS `data_group_label` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='标签组标签中间表';
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='标签组标签中间表';

CREATE TABLE IF NOT EXISTS `data_label` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -152,7 +152,7 @@ CREATE TABLE IF NOT EXISTS `data_label` (
`type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '标签类型 0:自定义标签 1:自动标注标签 2:ImageNet 3: MS COCO',
PRIMARY KEY (`id`) USING BTREE,
KEY `dataset` (`name`,`deleted`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='数据集标签';
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='数据集标签';

CREATE TABLE IF NOT EXISTS `data_label_group` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -168,7 +168,7 @@ CREATE TABLE IF NOT EXISTS `data_label_group` (
`operate_type` int(11) DEFAULT NULL COMMENT '操作类型 1:Json编辑器操作类型 2:自定义操作类型 3:导入操作类型',
`label_group_type` int(1) NOT NULL DEFAULT '0' COMMENT '标签组数据类型 0:视觉 1:文本',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='标签组';
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='标签组';

CREATE TABLE IF NOT EXISTS `data_lesion_slice` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -183,7 +183,7 @@ CREATE TABLE IF NOT EXISTS `data_lesion_slice` (
`draw_info` text,
`origin_user_id` bigint(19) DEFAULT NULL COMMENT '资源拥有者ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='数据病变切片';

CREATE TABLE IF NOT EXISTS `data_medicine` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
@@ -205,7 +205,7 @@ CREATE TABLE IF NOT EXISTS `data_medicine` (
`type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类型 0: private 私有数据, 1:team 团队数据 2:public 公开数据',
`annotate_type` smallint(5) NOT NULL DEFAULT '0' COMMENT '标注类型: 1.器官分割 2.病灶检测之肺结节检测',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='医学数据集';
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='医学数据集';

CREATE TABLE IF NOT EXISTS `data_medicine_file` (
`id` bigint(20) unsigned zerofill NOT NULL AUTO_INCREMENT COMMENT 'ID',
@@ -223,7 +223,7 @@ CREATE TABLE IF NOT EXISTS `data_medicine_file` (
`status` tinyint(4) DEFAULT NULL COMMENT '状态 101-未标注 103-自动标注完成 104-完成',
`image_position_patient` double(11,1) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='医学数据集';
) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='医学数据集';

CREATE TABLE IF NOT EXISTS `data_sequence` (
`id` int(11) NOT NULL,
@@ -232,7 +232,7 @@ CREATE TABLE IF NOT EXISTS `data_sequence` (
`step` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `business_code_unique` (`business_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='自定义获取主键ID表';
) ENGINE=InnoDB COMMENT='自定义获取主键ID表';

CREATE TABLE IF NOT EXISTS `data_task` (
`id` bigint(20) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT COMMENT 'ID',
@@ -261,13 +261,7 @@ CREATE TABLE IF NOT EXISTS `data_task` (
PRIMARY KEY (`id`) USING BTREE,
KEY `deleted` (`deleted`) USING BTREE,
KEY `ds_status` (`datasets`,`status`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '标注任务信息' ROW_FORMAT = Dynamic;

create index deleted
on data_task (deleted);

create index ds_status
on data_task (datasets, status);
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '标注任务信息';

create table if not exists dict
(
@@ -1282,11 +1276,6 @@ CREATE TABLE IF NOT EXISTS `oauth_refresh_token` (
`authentication` blob
) comment '权限token刷新表' ENGINE=InnoDB DEFAULT CHARSET=utf8;

create index label_dataset_id_indx
on data_file_annotation (label_id, dataset_id);

create index version_file_index
on data_file_annotation (version_file_id);

-- 操作权限表
CREATE TABLE if not exists `permission` (


+ 126
- 311
dubhe-server/sql/02-Dubhe-DML.sql View File

@@ -1,7 +1,7 @@
-- DML 脚本
use dubhe-cloud-prod;

use `dubhe-cloud-prod`;

SET SQL_SAFE_UPDATES = 0;
-- 原boot单体项目 DML 脚本内容

-- truncate table dict;
@@ -15,6 +15,71 @@ use dubhe-cloud-prod;
-- 初始化默认用户
INSERT INTO user (id, email, enabled, nick_name, password, phone, sex, username) VALUES (1, 'admin@tom.com', true, '系统管理员', '$2a$10$VhAWNoUtpJKr000UYmfMee4SONBXJuRWGus64bmomyFKEo4kiwHve', '18888888888', '男', 'admin');

insert into `menu` (`id`,`pid`,`type`,`name`,`icon`,`path`,`component`,`component_name`,`layout`,`permission`,`back_to`,`ext_config`,`hidden`,`cache`,`sort`,`create_user_id`,`update_user_id`,`deleted`) values
(1,0,1,'概览','yibiaopan','dashboard','dashboard/dashboard','Dashboard','BaseLayout',NULL,NULL,NULL,'\0','\0',1,NULL,NULL,'\0'),
(10,0,0,'数据管理','shujuguanli','data',NULL,NULL,NULL,'data',NULL,NULL,'\0','\0',2,NULL,NULL,'\0'),
(11,10,1,'数据集管理','shujuguanli','datasets/list','dataset/list','Datasets','BaseLayout','data:dataset',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(12,10,1,'图像分类',NULL,'datasets/classify/:datasetId','dataset/classify','DatasetClassify','DetailLayout',NULL,NULL,NULL,'','\0',999,NULL,NULL,'\0'),
(13,10,1,'目标检测',NULL,'datasets/annotate/:datasetId/file/:fileId','dataset/annotate','AnnotateDatasetFile','DetailLayout',NULL,NULL,NULL,'','\0',999,NULL,NULL,'\0'),
(14,10,1,'目标检测',NULL,'datasets/annotate/:datasetId','dataset/annotate','AnnotateDataset','DetailLayout',NULL,NULL,NULL,'','\0',999,NULL,NULL,'\0'),
(15,10,1,'目标跟踪',NULL,'datasets/track/:datasetId/file/:fileId','dataset/annotate','TrackDatasetFile','DatasetLayout',NULL,NULL,NULL,'','\0',999,NULL,NULL,'\0'),
(16,10,1,'目标跟踪',NULL,'datasets/track/:datasetId','dataset/annotate','TrackDataset','DatasetLayout',NULL,NULL,NULL,'','\0',999,NULL,NULL,'\0'),
(17,10,1,'数据集版本管理',NULL,'datasets/:datasetId/version','dataset/version','DatasetVersion','SubpageLayout',NULL,NULL,NULL,'','\0',999,NULL,NULL,'\0'),
(30,0,0,'算法开发','xunlianzhunbei','development',NULL,NULL,NULL,'development',NULL,NULL,'\0','\0',3,NULL,NULL,'\0'),
(31,30,1,'Notebook','kaifahuanjing','development:notebook','development/notebook','Notebook','BaseLayout','notebook',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(32,30,1,'算法管理','mobanguanli','algorithm','algorithm/index','Algorithm','BaseLayout','development:algorithm',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(40,0,0,'训练管理','xunlianguocheng','training',NULL,NULL,NULL,'training',NULL,NULL,'\0','\0',4,NULL,NULL,'\0'),
(41,40,1,'镜像管理','jingxiangguanli','image','trainingImage/index','TrainingImage','BaseLayout','training:image',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(42,40,1,'训练任务','renwuguanli','job','trainingJob/index','TrainingJob','BaseLayout','training:job',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(43,40,1,'任务详情',NULL,'jobDetail','trainingJob/detail','JobDetail','SubpageLayout',NULL,NULL,NULL,'','\0',999,NULL,NULL,'\0'),
(44,40,1,'添加任务',NULL,'jobAdd','trainingJob/add','jobAdd','SubpageLayout',NULL,NULL,NULL,'','\0',999,NULL,NULL,'\0'),
(45,40,1,'可视化任务','mobanguanli','visual','trainingJob/trainingVisualList','TrainVisual','BaseLayout','training:visual',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(50,0,1,'模型管理','moxingguanli','model',NULL,NULL,NULL,'model',NULL,NULL,'\0','\0',5,NULL,NULL,'\0'),
(51,50,1,'模型列表','zongshili','model','model/index','ModelModel','BaseLayout','model:model',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(52,50,1,'模型优化','caidanguanli','optimize','modelOptimize/index','ModelOptimize','BaseLayout','model:optimize',NULL,NULL,'\0','\0',52,1,1,'\0'),
(53,50,1,'模型版本管理',NULL,'version','model/version','ModelVersion','SubpageLayout','model:branch',NULL,NULL,'','\0',999,NULL,NULL,'\0'),
(54,50,1,'模型优化执行记录',NULL,'optimize/record','modelOptimize/record','ModelOptRecord','SubpageLayout',NULL,NULL,NULL,'\0','\0',54,1,1,'\0'),
(90,0,0,'控制台','kongzhitaixitongguanliyuankejian','system',NULL,NULL,NULL,'system',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(91,90,1,'用户管理','yonghuguanli','user','system/user/index','SystemUser','BaseLayout','system:user',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(92,90,1,'角色管理','jiaoseguanli','role','system/role/index','SystemRole','BaseLayout','system:role',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(93,90,1,'菜单管理','caidanguanli','menu','system/menu/index','SystemMenu','BaseLayout','system:menu',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(94,90,1,'字典管理','mobanguanli','dict','system/dict/index','SystemDict','BaseLayout','system:dict',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(95,90,1,'集群状态','jiqunguanli','node','system/node/index','SystemNode','BaseLayout','system:node',NULL,NULL,'\0','\0',999,NULL,NULL,'\0'),
(96,90,1,'回收站','shuju1','recycle','system/recycle/index','SystemRecycle','BaseLayout','system:recycle',NULL,NULL,'\0','\0',999,1,1,'\0'),
(97,0,0,'模型炼知','icon_huabanfuben1','atlas',NULL,NULL,NULL,NULL,NULL,NULL,'\0','\0',70,1,1,'\0'),
(100,10,1,'编辑标签组',NULL,'labelgroup/edit','labelGroup/labelGroupForm','LabelGroupEdit','SubpageLayout',NULL,NULL,NULL,'','\0',24,1,1,'\0'),
(101,10,1,'标签组详情',NULL,'labelgroup/detail','labelGroup/labelGroupForm','LabelGroupDetail','SubpageLayout',NULL,NULL,NULL,'','\0',23,1,1,'\0'),
(102,10,1,'创建标签组',NULL,'labelgroup/create','labelGroup/labelGroupForm','LabelGroupCreate','SubpageLayout',NULL,NULL,NULL,'','\0',22,1,1,'\0'),
(103,10,1,'标签组管理','mobanguanli','labelgroup','labelGroup/index','LabelGroup','BaseLayout','',NULL,NULL,'\0','\0',21,1,1,'\0'),
(1058,0,0,'云端Serving','shujumoxing','cloudserving',NULL,NULL,NULL,NULL,NULL,NULL,'\0','\0',60,1,1,'\0'),
(1059,1058,1,'在线服务','shujumoxing','onlineserving','cloudServing','CloudServing','BaseLayout','serving:online',NULL,NULL,'\0','\0',61,1,1,'\0'),
(1060,1058,1,'批量服务','shujumoxing','batchserving','cloudServing/batch','BatchServing','BaseLayout','serving:batch',NULL,NULL,'\0','\0',62,1,1,'\0'),
(1061,1058,1,'部署详情',NULL,'onlineserving/detail','cloudServing/detail','CloudServingDetail','SubpageLayout','serving:online',NULL,NULL,'','\0',63,1,1,'\0'),
(1062,1058,1,'部署详情',NULL,'batchserving/detail','cloudServing/batchDetail','BatchServingDetail','SubpageLayout','serving:batch',NULL,NULL,'','\0',64,1,1,'\0'),
(1063,1058,1,'部署在线服务',NULL,'onlineserving/form','cloudServing/formPage','CloudServingForm','SubpageLayout','serving:online',NULL,NULL,'','\0',65,1,1,'\0'),
(1064,97,1,'度量管理','icon_huabanfuben1','measure','atlas/measure','Measure','BaseLayout','atlas:measure',NULL,NULL,'\0','\0',71,1,1,'\0'),
(1065,97,1,'图谱可视化','icon_huabanfuben1','graphvisual','atlas/graphVisual','AtlasGraphVisual','BaseLayout',NULL,NULL,NULL,'\0','\0',72,1,1,'\0'),
(1066,97,1,'图谱列表','icon_huabanfuben1','graph','atlas/graphList','AtlasGraph','BaseLayout',NULL,NULL,NULL,'\0','\0',73,1,1,'\0'),
(1067,10,1,'图像语义分割',NULL,'datasets/segmentation/:datasetId','dataset/annotate','SegmentationDataset','DatasetLayout',NULL,NULL,'{\"test\": 1}','','\0',19,1,1,'\0'),
(1068,10,1,'图像语义分割',NULL,'datasets/segmentation/:datasetId/file/:fileId','dataset/annotate','SegmentationDatasetFile','DatasetLayout',NULL,NULL,NULL,'','\0',18,1,1,'\0'),
(1069,10,1,'医学影像阅读','beauty','datasets/medical/viewer/:medicalId','dataset/medical/viewer','DatasetMedicalViewer','FullpageLayout',NULL,NULL,NULL,'','\0',999,1,1,'\0'),
(1070,10,1,'数据集管理','shujuguanli','datasets','dataset/fork','DatasetFork','BaseLayout',NULL,NULL,NULL,'\0','\0',17,1,1,'\0'),
(1071,10,1,'医疗影像数据集',NULL,'datasets/medical','dataset/medical/list','DatasetMedical','BaseLayout',NULL,NULL,NULL,'','\0',25,1,1,'\0'),
(1072,10,1,'数据集场景选择',NULL,'datasets/entrance','dataset/entrance','Entrance','BaseLayout',NULL,NULL,NULL,'','\0',20,1,1,'\0'),
(1073,10,1,'文本分类',NULL,'datasets/textclassify/:datasetId','dataset/nlp/textClassify','TextClassify','DetailLayout','',NULL,NULL,'','\0',26,1,1,'\0'),
(1074,10,1,'文本标注',NULL,'datasets/text/annotation/:datasetId','dataset/nlp/annotation','TextAnnotation','DetailLayout',NULL,NULL,NULL,'','\0',27,1,1,'\0'),
(1075,10,1,'导入表格',NULL,'datasets/table/import','dataset/tableImport','TableImport','DetailLayout',NULL,NULL,'{}','','\0',999,1,1,'\0'),
(1076,90,1,'用户组管理','tuanduiguanli-tuanduiguanli','userGroup','system/userGroup','UserGroup','BaseLayout','system:userGroup',NULL,'{}','\0','\0',91,3,3,'\0'),
(1077,90,1,'权限管理','fuwuguanli','authCode','system/authCode','AuthCode','BaseLayout','system:authCode',NULL,'{}','\0','\0',92,1,3,'\0'),
(1078,10,1,'文本数据集',NULL,'datasets/text/list/:datasetId','dataset/nlp/list','TextList','DetailLayout',NULL,NULL,'{}','','\0',999,1,1,'\0'),
(1079,10,1,'音频数据集',NULL,'datasets/audio/list/:datasetId','dataset/audio/list','AudioList','DetailLayout',NULL,NULL,'{}','','\0',999,1,1,'\0'),
(1080,10,1,'音频标注',NULL,'datasets/audio/annotation/:datasetId','dataset/audio/annotation','AudioAnnotation','DetailLayout',NULL,NULL,'{}','','\0',999,1,1,'\0'),
(1081,10,1,'自定义数据集',NULL,'datasets/custom/:datasetId','dataset/custom','CustomList','DetailLayout',NULL,NULL,'{}','','\0',999,1,1,'\0'),
(1084,90,1,'资源规格管理','xunlianzhunbei','resources','system/resources','Resources','BaseLayout','system:specs',NULL,NULL,'\0','\0',999,NULL,NULL,'\0');

insert into `auth`(`id`,`auth_code`,`description`,`create_user_id`,`update_user_id`,`create_time`,`update_time`,`deleted`) values
(1,'admin权限组','默认全部操作权限',1,1,'2021-07-01 08:54:32','2021-07-01 08:54:32','\0');

-- 初始化默认角色
INSERT INTO `role`(`id`, `name`, `permission`) VALUES (1, '管理员', 'admin');
INSERT INTO `role`(`id`, `name`, `permission`) VALUES (2, '注册用户', 'register');
@@ -22,49 +87,6 @@ INSERT INTO `role`(`id`, `name`, `permission`) VALUES (2, '注册用户', 'regis
-- 初始化 admin 角色
INSERT INTO `users_roles`(`user_id`, `role_id`) VALUES (1, 1);

INSERT INTO `menu`(`id`, `pid`, `type`, `name`, `icon`, `path`, `component`, `component_name`, `layout`, `hidden`, `permission`) VALUES
-- 概览, 1~9
(1, 0, 1, '概览', 'yibiaopan', 'dashboard', 'dashboard/dashboard', 'Dashboard', 'BaseLayout', b'0', NULL),
-- 数据管理, 10~29
(10, 0, 0, '数据管理', 'shujuguanli', 'data', NULL, NULL, NULL, b'0', 'data'),
(11, 10, 1, '数据集管理', 'shujuguanli', 'datasets', 'dataset/list', 'Datasets', 'BaseLayout', b'0', 'data:dataset'),
(12, 10, 1, '图像分类', NULL, 'datasets/classify/:datasetId', 'dataset/classify', 'DatasetClassify', 'DetailLayout', b'1', NULL),
(13, 10, 1, '目标检测', NULL, 'datasets/annotate/:datasetId/file/:fileId', 'dataset/annotate', 'AnnotateDatasetFile', 'DetailLayout', b'1', NULL),
(14, 10, 1, '目标检测', NULL, 'datasets/annotate/:datasetId', 'dataset/annotate', 'AnnotateDataset', 'DetailLayout', b'1', NULL),
(15, 10, 1, '目标跟踪', NULL, 'datasets/track/:datasetId/file/:fileId', 'dataset/annotate', 'TrackDatasetFile', 'DatasetLayout', b'1', NULL),
(16, 10, 1, '目标跟踪', NULL, 'datasets/track/:datasetId', 'dataset/annotate', 'TrackDataset', 'DatasetLayout', b'1', NULL),
(17, 10, 1, '数据集版本管理', NULL, 'datasets/:datasetId/version', 'dataset/version', 'DatasetVersion', 'SubpageLayout', b'1', NULL),
-- 算法开发, 30~39
(30, 0, 0, '算法开发', 'xunlianzhunbei', 'development', NULL, NULL, NULL, b'0', 'development'),
(31, 30, 1, 'Notebook', 'kaifahuanjing', 'notebook', 'development/notebook', 'Notebook', 'BaseLayout', b'0', 'development:notebook'),
(32, 30, 1, '算法管理', 'mobanguanli', 'algorithm', 'algorithm/index', 'Algorithm', 'BaseLayout', b'0', 'development:algorithm'),
-- 训练管理, 40~49
(40, 0, 0, '训练管理', 'xunlianguocheng', 'training', NULL, NULL, NULL, b'0', 'training'),
(41, 40, 1, '镜像管理', 'jingxiangguanli', 'image', 'trainingImage/index', 'TrainingImage', 'BaseLayout', b'0', 'training:image'),
(42, 40, 1, '训练任务', 'renwuguanli', 'job', 'trainingJob/index', 'TrainingJob', 'BaseLayout', b'0', 'training:job'),
(43, 40, 1, '任务详情', NULL, 'jobDetail', 'trainingJob/detail', 'JobDetail', 'SubpageLayout', b'1', NULL),
(44, 40, 1, '添加任务', NULL, 'jobAdd', 'trainingJob/add', 'jobAdd', 'SubpageLayout', b'1', NULL),
(45, 40, 1, '可视化任务', 'mobanguanli', 'visual', 'trainingJob/trainingVisualList', 'TrainVisual', 'BaseLayout', b'0', 'training:visual'),
-- 模型管理, 50~59
(50, 0, 1, '模型管理', 'moxingguanli', 'model', NULL, NULL, NULL, b'0', 'model'),
(51, 50, 1, '模型列表', 'zongshili', 'model', 'model/index', 'ModelModel', 'BaseLayout', b'0', 'model:model'),
(53, 50, 1, '模型版本管理', NULL, 'version', 'model/version', 'ModelVersion', 'SubpageLayout', b'1', 'model:branch'),
-- 控制台, 90~99
(90, 0, 0, '控制台', 'kongzhitaixitongguanliyuankejian', 'system', NULL, NULL, NULL, b'0', 'system'),
(91, 90, 1, '用户管理', 'yonghuguanli', 'user', 'system/user/index', 'SystemUser', 'BaseLayout', b'0', 'system:user'),
(92, 90, 1, '角色管理', 'jiaoseguanli', 'role', 'system/role/index', 'SystemRole', 'BaseLayout', b'0', 'system:role'),
(93, 90, 1, '菜单管理', 'caidanguanli', 'menu', 'system/menu/index', 'SystemMenu', 'BaseLayout', b'0', 'system:menu'),
(94, 90, 1, '字典管理', 'mobanguanli', 'dict', 'system/dict/index', 'SystemDict', 'BaseLayout', b'0', 'system:dict'),
(95, 90, 1, '集群状态', 'jiqunguanli', 'node', 'system/node/index', 'SystemNode', 'BaseLayout', b'0', 'system:node');

INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 90, 1, '回收站', 'shuju1', 'recycle', 'system/recycle/index', 'SystemRecycle', 'BaseLayout', 'system:recycle', false, false, 999, 1, 1, false, null, null);

INSERT INTO `roles_menus` (`role_id`, `menu_id`) SELECT 1, `id` FROM `menu`;
INSERT INTO `roles_menus` (`role_id`, `menu_id`) SELECT 2, `id` FROM `menu` WHERE `id` != 90 and pid != 90 ;

-- 字典定义
INSERT INTO `dict`(`id`, `name`, `remark`) VALUES (1, 'Layout', '页面布局');
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (1, '基本布局', 'BaseLayout', 1);
@@ -209,36 +231,52 @@ INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (38, 'shuf
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (38, 'shufflenet_v2_x1_5', 'shufflenet_v2_x1_5', '34');
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (38, 'shufflenet_v2_x2_0', 'shufflenet_v2_x2_0', '35');

INSERT INTO `harbor_project` (`id`, `image_name`, `create_resource`, `create_user_id`, `update_user_id`, `deleted`) VALUES (1, 'notebook', 0, NULL, NULL, b'0');

insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
`update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
values ('1', 'oneflow', 'train/oneflow:cudnn7-py35-of', 'cudnn7-py35-of', '预置镜像', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');

insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
`update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
values ('2', 'oneflow', 'train/oneflow:cudnn7-py36-of', 'cudnn7-py36-of', '预置镜像,其中包含:asn1crypto==0.24.0 cryptography==2.1.4 idna==2.6 keyring==10.6.0 keyrings.alt==3.0 numpy==1.19.0 oneflow==0.1.0 pandas==1.0.5 protobuf==3.12.2 pycrypto==2.6.1', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');

insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
`update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
values ('3', 'oneflow', 'train/oneflow:cudnn7-py36-of010-yolov3', 'cudnn7-py36-of010-yolov3', '预置镜像,其中包含:asn1crypto==0.24.0 cryptography==2.1.4 idna==2.6 keyring==10.6.0 keyrings.alt==3.0 numpy==1.19.0 oneflow==0.1.0 protobuf==3.12.2 pycrypto==2.6.1 pygobject==3.26.1', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');

insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
`update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
values ('4', 'oneflow', 'train/oneflow:cudnn7-py36-of010-yolo0717', 'cudnn7-py36-of010-yolo0717', '预置镜像,其中包含:asn1crypto==0.24.0 cryptography==2.1.4 idna==2.6 keyring==10.6.0 keyrings.alt==3.0 numpy==1.19.0 oneflow==0.1.0 protobuf==3.12.2 pycrypto==2.6.1 pygobject==3.26.1 python-apt==1.6.5+ubuntu0.3 pyxdg==0.25 SecretStorage==2.3.1 six==1.11.0 unattended-upgrade==0.1', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');
-- 增加在线服务运行状态
INSERT INTO `dict`(`id`, `name`, `remark`) VALUES (27, 'serving_status', '服务状态');
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (27, '部署中', '1', 1);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (27, '运行中', '2', 2);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (27, '已停止', '3', 3);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (27, '运行失败', '0', 4);

insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
`update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
values ('5', 'tensorflow', 'train/tensorflow:latest', 'latest', '预置镜像', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');
-- 增加在线服务各框架部署参数
INSERT INTO `dict`(`id`, `name`, `remark`) VALUES (30, 'deploy_params', '部署参数');
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (30, 'signature_name', 'Tensorflow模型接口定义名称(serving_default)', 1);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (30, 'reshape_size', '图片预处理形状 [H, W]', 2);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (30, 'prepare_mode', 'keras/Tensoflow模型预处理模式(tfhub、caffe、tf、torch)', 3);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (30, 'model_structure', 'pytorch模型保存网络名称(model)', 4);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (30, 'job_name', 'oneflow模型推理job名称(inference)', 5);

insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
`update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
values ('6', 'pytorch', 'train/pytorch:cuda-9.2', 'cuda-9.2', '预置镜像', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');
-- 补充模型来源
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (9, '模型转换', '3', 4);

insert into pt_image (project_name, image_resource, image_status, image_name, image_url, image_tag, remark, create_user_id, create_time, update_user_id, update_time, deleted, origin_user_id)
values ('serving', 1, 1, 'serving-gpu', 'serving/serving-gpu:base', 'base', 'serving预置镜像', 1, '2021-04-13 15:23:01', 1, '2021-04-13 15:23:07', 0, 0);
-- -- 新增镜像预置数据
-- insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
-- `update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
-- values ('1', 'oneflow', 'train/oneflow:cudnn7-py35-of', 'cudnn7-py35-of', '预置镜像', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');
--
-- insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
-- `update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
-- values ('2', 'oneflow', 'train/oneflow:cudnn7-py36-of', 'cudnn7-py36-of', '预置镜像,其中包含:asn1crypto==0.24.0 cryptography==2.1.4 idna==2.6 keyring==10.6.0 keyrings.alt==3.0 numpy==1.19.0 oneflow==0.1.0 pandas==1.0.5 protobuf==3.12.2 pycrypto==2.6.1', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');
--
-- insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
-- `update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
-- values ('3', 'oneflow', 'train/oneflow:cudnn7-py36-of010-yolov3', 'cudnn7-py36-of010-yolov3', '预置镜像,其中包含:asn1crypto==0.24.0 cryptography==2.1.4 idna==2.6 keyring==10.6.0 keyrings.alt==3.0 numpy==1.19.0 oneflow==0.1.0 protobuf==3.12.2 pycrypto==2.6.1 pygobject==3.26.1', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');
--
-- insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
-- `update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
-- values ('4', 'oneflow', 'train/oneflow:cudnn7-py36-of010-yolo0717', 'cudnn7-py36-of010-yolo0717', '预置镜像,其中包含:asn1crypto==0.24.0 cryptography==2.1.4 idna==2.6 keyring==10.6.0 keyrings.alt==3.0 numpy==1.19.0 oneflow==0.1.0 protobuf==3.12.2 pycrypto==2.6.1 pygobject==3.26.1 python-apt==1.6.5+ubuntu0.3 pyxdg==0.25 SecretStorage==2.3.1 six==1.11.0 unattended-upgrade==0.1', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');
--
-- insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
-- `update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
-- values ('5', 'tensorflow', 'train/tensorflow:latest', 'latest', '预置镜像', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');
--
-- insert into `pt_image` (`id`, `image_name`, `image_url`, `image_tag`, `remark`, `create_user_id`, `create_time`,
-- `update_user_id`, `update_time`, `deleted`, `project_name`, `image_resource`, `image_status`)
-- values ('6', 'pytorch', 'train/pytorch:cuda-9.2', 'cuda-9.2', '预置镜像', 1, '2020-07-01 11:40:30', NULL, NULL, b'0', 'train', 1, '1');
--
-- insert into pt_image (project_name, image_resource, image_status, image_name, image_url, image_tag, remark, create_user_id, create_time, update_user_id, update_time, deleted, origin_user_id)
-- values ('serving', 1, 1, 'serving-gpu', 'serving/serving-gpu:base', 'base', 'serving预置镜像', 1, '2021-04-13 15:23:01', 1, '2021-04-13 15:23:07', 0, 0);

-- 新增算法用途预置数据
insert into `pt_auxiliary_info` (`origin_user_id`,`type`,`aux_info`) values (0,'algorithem_usage','目标检测');
@@ -2508,76 +2546,12 @@ INSERT INTO data_sequence (id, business_code, start, step) VALUES (1, 'DATA_FILE
INSERT INTO data_sequence (id, business_code, start, step) VALUES (2, 'DATA_VERSION_FILE', 1, 5000);
INSERT INTO data_sequence (id, business_code, start, step) VALUES (3, 'DATA_FILE_ANNOTATION', 1, 5000);

INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES (100, false, 'labelGroup/labelGroupForm', 'LabelGroupEdit', true, null, '编辑标签组', 'labelgroup/edit', null, 10, 24, 1, 'SubpageLayout', current_timestamp, current_timestamp, 1, 1, false);
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES (101,false, 'labelGroup/labelGroupForm', 'LabelGroupDetail', true, null, '标签组详情', 'labelgroup/detail', null, 10, 23, 1, 'SubpageLayout', current_timestamp, current_timestamp, 1, 1, false);
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES (102,false, 'labelGroup/labelGroupForm', 'LabelGroupCreate', true, null, '创建标签组', 'labelgroup/create', null, 10, 22, 1, 'SubpageLayout', current_timestamp, current_timestamp, 1, 1, false);
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES (103,false, 'labelGroup/index', 'LabelGroup', false, 'mobanguanli', '标签组管理', 'labelgroup', '', 10, 21, 1, 'BaseLayout', current_timestamp, current_timestamp, 1, 1, false);

INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 100);
INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 101);
INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 102);
INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 103);

INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 100);
INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 101);
INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 102);
INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 103);

-- 第二版本初始化系统版本数据
INSERT INTO `system_version` (`id`, `version`) VALUES (1, 1);
INSERT INTO `system_version` (`id`, `version`) VALUES (2, 2);

INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid,sort, type, layout, create_time, update_time, create_user_id, update_user_id,deleted)
VALUES ('97', '', NULL, NULL, '', 'icon_huabanfuben1', '模型炼知', 'atlas', NULL, '0', '70', '0', NULL,'2020-11-20 09:08:12', '2020-11-20 09:08:12', '1', '1', '');
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid,sort, type, layout, create_time, update_time, create_user_id, update_user_id,deleted)
VALUES ('1064', '', 'atlas/measure', 'Measure', '', 'icon_huabanfuben1', '度量管理', 'measure', 'atlas:measure', '97', '71', '1','BaseLayout', '2020-11-20 11:03:20', '2020-11-20 11:03:20', '1', '1', '');
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid,sort, type, layout, create_time, update_time, create_user_id, update_user_id,deleted)
VALUES ('1065', '', 'atlas/graphVisual', 'AtlasGraphVisual', '', 'icon_huabanfuben1', '图谱可视化', 'graphvisual', NULL,'97', '72', '1', 'BaseLayout', '2020-11-20 11:07:14', '2020-11-20 11:07:14', '1', '1', '');
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid,sort, type, layout, create_time, update_time, create_user_id, update_user_id,deleted)
VALUES ('1066', '', 'atlas/graphList', 'AtlasGraph', '', 'icon_huabanfuben1', '图谱列表', 'graph', NULL, '97', '73', '1','BaseLayout', '2020-11-20 11:08:02', '2020-11-20 11:08:02', '1', '1', '');

INSERT INTO `dict`(`id`, `name`, `remark`) VALUES (27, 'serving_status', '服务状态');
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (27, '部署中', '1', 1);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (27, '运行中', '2', 2);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (27, '已停止', '3', 3);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (27, '运行失败', '0', 4);

INSERT INTO `dict`(`id`, `name`, `remark`) VALUES (30, 'deploy_params', '部署参数');
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (30, 'signature_name', 'Tensorflow模型接口定义名称(serving_default)', 1);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (30, 'reshape_size', '图片预处理形状 [H, W]', 2);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (30, 'prepare_mode', 'keras/Tensoflow模型预处理模式(tfhub、caffe、tf、torch)', 3);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (30, 'model_structure', 'pytorch模型保存网络名称(model)', 4);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (30, 'job_name', 'oneflow模型推理job名称(inference)', 5);

INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES (1058, false, NULL, NULL, false, 'shujumoxing', '云端Serving', 'cloudserving', NULL, 0, 60, 0, NULL, current_timestamp, current_timestamp, 1, 1, false);
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES(1059, false, 'cloudServing', 'CloudServing', false, 'shujumoxing', '在线服务', 'onlineserving', 'serving:online', 1058, 61, 1, 'BaseLayout', current_timestamp, current_timestamp, 1, 1, false);
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES(1060, false, 'cloudServing/batch', 'BatchServing', false, 'shujumoxing', '批量服务', 'batchserving', 'serving:batch', 1058, 62, 1, 'BaseLayout', current_timestamp, current_timestamp, 1, 1, false);
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES(1061, false, 'cloudServing/detail', 'CloudServingDetail', true, NULL, '部署详情', 'onlineserving/detail', 'serving:online', 1058, 63, 1, 'SubpageLayout', current_timestamp, current_timestamp, 1, 1, false);
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES(1062, false, 'cloudServing/batchDetail', 'BatchServingDetail', true, NULL, '部署详情', 'batchserving/detail', 'serving:batch', 1058, 64, 1, 'SubpageLayout', current_timestamp, current_timestamp, 1, 1, false);
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES(1063, false, 'cloudServing/formPage', 'CloudServingForm', true, NULL, '部署在线服务', 'onlineserving/form', 'serving:online', 1058, 65, 1, 'SubpageLayout', current_timestamp, current_timestamp, 1, 1, false);

INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 1058);
INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 1059);
INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 1060);
INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 1061);
INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 1062);
INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 1063);

INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 1058);
INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 1059);
INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 1060);
INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 1061);
INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 1062);
INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 1063);

-- 新增模型优化结果单位
INSERT INTO `dict`(`id`, `name`, `remark`) VALUES (29, 'opt_result', '模型优化-结果');
@@ -2585,62 +2559,15 @@ INSERT INTO `dict_detail` ( `dict_id`, `label`, `value`, `sort`) VALUES (29, 'ac
INSERT INTO `dict_detail` ( `dict_id`, `label`, `value`, `sort`) VALUES (29, 'reasoningTime', '(images/sec)', '2');
INSERT INTO `dict_detail` ( `dict_id`, `label`, `value`, `sort`) VALUES (29, 'modelSize', 'M', '3');

INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES
(52, false, 'modelOptimize/index', 'ModelOptimize', false, 'caidanguanli', '模型优化', 'optimize', 'model:optimize', 50, 52, 1, 'BaseLayout', current_timestamp, current_timestamp, 1, 1, false);
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid, sort, type, layout, create_time, update_time, create_user_id, update_user_id, deleted) VALUES
(54, false, 'modelOptimize/record', 'ModelOptRecord', false, null, '模型优化执行记录', 'optimize/record', null, 50, 54, 1, 'SubpageLayout', current_timestamp, current_timestamp, 1, 1, false);

INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 52);
INSERT INTO roles_menus (role_id, menu_id) VALUES (1, 54);
-- 初始化 admin 和 注册用户 菜单
INSERT INTO `roles_menus` (`role_id`, `menu_id`) SELECT 1, `id` FROM `menu`;
INSERT INTO `roles_menus` (`role_id`, `menu_id`) SELECT 2, `id` FROM `menu` WHERE `id` != 90 and pid != 90 ;

INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 52);
INSERT INTO roles_menus (role_id, menu_id) VALUES (2, 54);

-- auth服务 系统客户端认证数据初始化
INSERT INTO `oauth_client_details` (`client_id`, `resource_ids`, `client_secret`, `scope`, `authorized_grant_types`, `web_server_redirect_uri`, `authorities`, `access_token_validity`, `refresh_token_validity`, `additional_information`, `autoapprove`) VALUES
('dubhe-client', NULL, '$2a$10$RUYBRsyV2jpG7pvg/VNus.YHVebzfRen3RGeDe1LVEIJeHYe2F1YK', 'all', 'authorization_code,password,refresh_token', 'http://localhost:8866/oauth/callback', NULL, 3600, 2592000, NULL, NULL);


INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '图像语义分割', null, 'datasets/segmentation/:datasetId', 'dataset/annotate', 'SegmentationDataset', 'DatasetLayout', null, true, false, 19, 1, 1, false, null, '{"test": 1}');
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '图像语义分割', null, 'datasets/segmentation/:datasetId/file/:fileId', 'dataset/annotate', 'SegmentationDatasetFile', 'DatasetLayout', null, true, false, 18, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '医学影像阅读', 'beauty', 'datasets/medical/viewer/:medicalId', 'dataset/medical/viewer', 'DatasetMedicalViewer', 'FullpageLayout', null, true, false, 999, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '数据集管理', 'shujuguanli', 'datasets', 'dataset/fork', 'DatasetFork', 'BaseLayout', null, false, false, 17, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '医疗影像数据集', null, 'datasets/medical', 'dataset/medical/list', 'DatasetMedical', 'BaseLayout', null, true, false, 25, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '数据集场景选择', null, 'datasets/entrance', 'dataset/entrance', 'Entrance', 'BaseLayout', null, true, false, 20, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '文本分类', null, 'datasets/textclassify/:datasetId', 'dataset/nlp/textClassify', 'TextClassify', 'DetailLayout', '', true, false, 26, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '文本标注', null, 'datasets/text/annotation/:datasetId', 'dataset/nlp/annotation', 'TextAnnotation', 'DetailLayout', null, true, false, 27, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '导入表格', null, 'datasets/table/import', 'dataset/tableImport', 'TableImport', 'DetailLayout', null, true, false, 999, 1, 1, false, null, '{}');

INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/segmentation/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/segmentation/:datasetId/file/:fileId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/medical/viewer/:medicalId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/medical'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/entrance'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/textclassify/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/text/annotation/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/table/import'));


INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/segmentation/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/segmentation/:datasetId/file/:fileId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/medical/viewer/:medicalId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/medical'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/entrance'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/textclassify/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/text/annotation/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/table/import'));


update menu set name = '视觉/文本数据集' where name = '视觉文本数据集';

-- 初始化模型格式表pt_model_type
INSERT INTO `pt_model_type`(`frame_type`, `model_type`) VALUES (1, '1,17');
INSERT INTO `pt_model_type`(`frame_type`, `model_type`) VALUES (2, '1,9,10');
@@ -2673,41 +2600,8 @@ INSERT INTO `permission` VALUES (2, 1, '上传镜像', 'training:image:upload',
INSERT INTO `permission` VALUES (3, 1, '修改镜像', 'training:image:edit', 1, 1, '2021-04-26 16:19:37', '2021-04-26 16:19:37', b'0');
INSERT INTO `permission` VALUES (4, 1, '删除镜像', 'training:image:delete', 1, 1, '2021-04-26 16:19:37', '2021-04-26 16:19:37', b'0');

INSERT INTO menu (pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, create_time, update_time, deleted, back_to, ext_config) VALUES (90, 1, '用户组管理', 'tuanduiguanli-tuanduiguanli', 'userGroup', 'system/userGroup', 'UserGroup', 'BaseLayout', 'system:userGroup', false, false, 91, 3, 3, '2021-05-11 09:32:32', '2021-05-11 09:32:32', false, null, '{}');
INSERT INTO menu (pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, create_time, update_time, deleted, back_to, ext_config) VALUES (90, 1, '权限管理', 'fuwuguanli', 'authCode', 'system/authCode', 'AuthCode', 'BaseLayout', 'system:authCode', false, false, 92, 1, 3, '2021-05-19 09:16:32', '2021-05-19 09:19:44', false, null, '{}');

INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'userGroup'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'userGroup'));

INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'authCode'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'authCode'));


INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES (10,1,'文本数据集',null,'datasets/text/list/:datasetId','dataset/nlp/list','TextList','DetailLayout',null,true,false,999,1,1,false,null,'{}');
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES (10,1,'音频数据集',null,'datasets/audio/list/:datasetId','dataset/audio/list','AudioList','DetailLayout',null,true,false,999,1,1,false,null,'{}');
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES (10,1,'音频标注',null,'datasets/audio/annotation/:datasetId','dataset/audio/annotation','AudioAnnotation','DetailLayout',null,true,false,999,1,1,false,null,'{}');
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES (10,1,'自定义数据集',null,'datasets/custom/:datasetId','dataset/custom','CustomList','DetailLayout',null,true,false,999,1,1,false,null,'{}');


INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/text/list/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/audio/list/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/audio/annotation/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/custom/:datasetId'));


INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/text/list/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/audio/list/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/audio/annotation/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/custom/:datasetId'));

-- 菜单新增资源规格相关路由
INSERT INTO `menu`( `pid`, `type`, `name`, `icon`, `path`, `component`, `component_name`, `layout`, `hidden`, `permission`) VALUES
(90, 1, '资源规格管理','xunlianzhunbei','resources','system/resources','Resources','BaseLayout',b'0','system:specs');

-- 初始化资源规格
-- 初始化notebook资源规格
@@ -2780,151 +2674,23 @@ INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('32CPU256GB内存 8GPU',1,3,32,8,256000,50000);

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '控制台', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '用户管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建用户', 'system:user:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑用户', 'system:user:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除用户', 'system:user:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '用户组管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建用户组', 'system:userGroup:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑用户组', 'system:userGroup:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除用户组', 'system:userGroup:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑成员', 'system:userGroup:editUser', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '批量修改角色', 'system:userGroup:editUserRole', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '批量激活锁定', 'system:userGroup:editUserState', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '批量删除用户', 'system:userGroup:deleteUser', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '权限管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建权限组', 'system:authCode:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑权限组', 'system:authCode:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除权限`组', 'system:authCode:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建权限', 'system:permission:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑权限', 'system:permission:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除权限', 'system:permission:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '角色管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建角色', 'system:role:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑角色', 'system:role:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除角色', 'system:role:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '权限分配', 'system:role:auth', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '菜单分配', 'system:role:menu', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '菜单管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除菜单', 'system:menu:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑菜单', 'system:menu:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建菜单', 'system:menu:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '字典管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建字典', 'system:dict:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑字典', 'system:dict:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除字典', 'system:dict:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '字典详情-创建', 'system:dictDetail:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '字典详情-修改', 'system:dictDetail:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '字典详情-删除', 'system:dictDetail:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '资源规格管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建资源规格', 'system:specs:create', 1, 1 );
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改资源规格', 'system:specs:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除资源规格', 'system:specs:delete', 1, 1);

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '算法开发', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '算法管理', 1, 1 from permission where name='算法开发';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建算法', 'development:algorithm:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改算法', 'development:algorithm:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除算法', 'development:algorithm:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, 'notebook', 1, 1 from permission where name='算法开发';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建notebook', 'notebook:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改notebook', 'notebook:update', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '打开notebook', 'notebook:open', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '启动notebook', 'notebook:start', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '停止notebook', 'notebook:stop', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除notebook', 'notebook:delete', 1, 1);
-- 删除无效预置算法
delete from pt_train_algorithm where algorithm_name in ('OneFlow预置算法-resnet50','OneFlow预置算法-bert','OneFlow预置算法-alexnet','OneFlow预置算法-mobilenetv2','OneFlow预置算法-dcgan','OneFlow预置算法-vgg16','OneFlow预置算法-insightface','OneFlow预置算法-yolov3','OneFlow预置算法-deep_and_wide');



-- 修改训练主表字段
-- alter table pt_train_job change out_path model_path varchar(128) default '' null comment '训练模型输出路径';
-- alter table pt_train_job change log_path out_path varchar(128) default '' null comment '训练输出路径';
-- 修改算法表字段
-- alter table pt_train_algorithm change is_train_out is_train_model_out tinyint(1) default 1 null comment '是否输出训练结果:1是,0否';
-- alter table pt_train_algorithm change is_train_log is_train_out tinyint(1) default 1 null comment '是否输出训练信息:1是,0否';

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '模型管理', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '模型列表', 1, 1 from permission where name='模型管理';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型列表-创建', 'model:model:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型列表-修改', 'model:model:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型列表-删除', 'model:model:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '模型优化', 1, 1 from permission where name='模型管理';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建任务', 'model:optimize:createTask', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '提交任务', 'model:optimize:submitTask', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改任务', 'model:optimize:editTask', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除任务', 'model:optimize:deleteTask', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '提交任务实例', 'model:optimize:submitTaskInstance', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '取消任务实例实例', 'model:optimize:cancelTaskInstance', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除任务实例', 'model:optimize:deleteTaskInstance', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '模型版本管理', 1, 1 from permission where name='模型管理';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型版本管理-创建', 'model:branch:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型版本管理-删除', 'model:branch:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型版本管理-转预置', 'model:branch:convertPreset', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型版本管理-转onnx', 'model:branch:convertOnnx', 1, 1);

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '训练管理', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '镜像管理', 1, 1 from permission where name='训练管理';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '上传镜像', 'training:image:upload', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改镜像', 'training:image:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除镜像', 'training:image:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '训练任务', 1, 1 from permission where name='训练管理';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建训练', 'training:job:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改训练', 'training:job:update', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除训练', 'training:job:delete', 1, 1);

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '云端serving', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '在线服务', 1, 1 from permission where name='云端serving';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建服务', 'serving:online:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改服务', 'serving:online:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除服务', 'serving:online:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '启动服务', 'serving:online:start', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '停止服务', 'serving:online:stop', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '批量服务', 1, 1 from permission where name='云端serving';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建批量任务', 'serving:batch:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改批量服务', 'serving:batch:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除批量服务', 'serving:batch:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '启动批量服务', 'serving:batch:start', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '停止批量服务', 'serving:batch:stop', 1, 1);

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '模型炼知', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '度量管理', 1, 1 from permission where name='模型炼知';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建度量', 'atlas:measure:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑度量', 'atlas:measure:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除度量', 'atlas:measure:delete', 1, 1);
-- 修改任务参数模型输出路径、训练输出路径
alter table pt_train_param change out_path model_path varchar(128) default '' null comment '模型输出路径';
alter table pt_train_param change log_path out_path varchar(128) default '' null comment '输出路径';

insert into auth(id, auth_code, description, create_user_id, update_user_id) values (1, 'admin权限组', '默认全部操作权限', 1, 1);
insert into auth_permission (auth_id, permission_id) select 1, id from permission;
INSERT INTO `roles_auth` (role_id, auth_id) values (1, 1);


+ 0
- 682
dubhe-server/sql/09-Dubhe-Patch.sql View File

@@ -1,775 +0,0 @@
use dubhe-cloud-prod;

CREATE TABLE IF NOT EXISTS `oauth_access_token` (
`token_id` varchar(256) DEFAULT NULL,
`token` blob,
`authentication_id` varchar(256) DEFAULT NULL,
`user_name` varchar(256) DEFAULT NULL,
`client_id` varchar(256) DEFAULT NULL,
`authentication` blob,
`refresh_token` varchar(256) DEFAULT NULL
) comment 'auth token存储表' ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `oauth_client_details` (
`client_id` varchar(256) NOT NULL,
`resource_ids` varchar(256) DEFAULT NULL,
`client_secret` varchar(256) DEFAULT NULL,
`scope` varchar(256) DEFAULT NULL,
`authorized_grant_types` varchar(256) DEFAULT NULL,
`web_server_redirect_uri` varchar(256) DEFAULT NULL,
`authorities` varchar(256) DEFAULT NULL,
`access_token_validity` int(11) DEFAULT NULL,
`refresh_token_validity` int(11) DEFAULT NULL,
`additional_information` varchar(4096) DEFAULT NULL,
`autoapprove` varchar(256) DEFAULT NULL,
PRIMARY KEY (`client_id`) USING BTREE
) comment '客户端权限配置表' ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `oauth_refresh_token` (
`token_id` varchar(256) DEFAULT NULL,
`token` blob,
`authentication` blob
) comment '权限token刷新表' ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `oauth_client_details` (`client_id`, `resource_ids`, `client_secret`, `scope`, `authorized_grant_types`, `web_server_redirect_uri`, `authorities`, `access_token_validity`, `refresh_token_validity`, `additional_information`, `autoapprove`) VALUES
('dubhe-client', NULL, '$2a$10$RUYBRsyV2jpG7pvg/VNus.YHVebzfRen3RGeDe1LVEIJeHYe2F1YK', 'all', 'authorization_code,password,refresh_token', 'http://localhost:8866/oauth/callback', NULL, 3600, 2592000, NULL, NULL);

alter table `pt_model_info`
add `packaged` tinyint default 0 not null comment '模型是否已经打包,0未打包,1打包完成';

alter table `pt_model_info`
add `tags` json null comment 'tag信息';

INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid,sort, type, layout, create_time, update_time, create_user_id, update_user_id,deleted)
VALUES ('97', '', NULL, NULL, '', 'icon_huabanfuben1', '模型炼知', 'atlas', NULL, '0', '70', '0', NULL,'2020-11-20 09:08:12', '2020-11-20 09:08:12', '1', '1', '');
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid,sort, type, layout, create_time, update_time, create_user_id, update_user_id,deleted)
VALUES ('1064', '', 'atlas/measure', 'Measure', '', 'icon_huabanfuben1', '度量管理', 'measure', 'atlas:measure', '97', '71', '1','BaseLayout', '2020-11-20 11:03:20', '2020-11-20 11:03:20', '1', '1', '');
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid,sort, type, layout, create_time, update_time, create_user_id, update_user_id,deleted)
VALUES ('1065', '', 'atlas/graphVisual', 'AtlasGraphVisual', '', 'icon_huabanfuben1', '图谱可视化', 'graphvisual', NULL,'97', '72', '1', 'BaseLayout', '2020-11-20 11:07:14', '2020-11-20 11:07:14', '1', '1', '');
INSERT INTO menu (id, cache, component, component_name, hidden, icon, name, path, permission, pid,sort, type, layout, create_time, update_time, create_user_id, update_user_id,deleted)
VALUES ('1066', '', 'atlas/graphList', 'AtlasGraph', '', 'icon_huabanfuben1', '图谱列表', 'graph', NULL, '97', '73', '1','BaseLayout', '2020-11-20 11:08:02', '2020-11-20 11:08:02', '1', '1', '');

ALTER TABLE pt_measure
ADD dataset_id BIGINT NOT NULL COMMENT '数据集id' AFTER name;
ALTER TABLE pt_measure
ADD dateset_url VARCHAR(32) NULL COMMENT '数据集url' AFTER dataset_id;
ALTER TABLE pt_measure
ADD model_urls TEXT NULL COMMENT '模型url' AFTER dataset_url;
ALTER TABLE pt_measure
ADD measure_status TINYINT(1) NOT NULL default 0 COMMENT '度量文件生成状态,0:生成中,1:生成成功,2:生成失败' AFTER model_urls;

ALTER TABLE `recycle_task`
CHANGE COLUMN `recycle_note` `recycle_note` VARCHAR(512) NULL DEFAULT NULL COMMENT '回收说明' AFTER `update_time`,
ADD COLUMN `remark` VARCHAR(512) NULL DEFAULT NULL COMMENT '备注' AFTER `recycle_note`;
ALTER TABLE `recycle_task`
ADD COLUMN `recycle_response` VARCHAR(512) NULL DEFAULT NULL COMMENT '回收响应信息' AFTER `remark`;
ALTER TABLE `recycle_task`
CHANGE COLUMN `recycle_status` `recycle_status` TINYINT(4) NULL DEFAULT '0' COMMENT '回收任务状态(0:待删除,1:已删除,2:删除失败,3:删除中,4:还原中,5:已还原)' AFTER `recycle_delay_date`;
ALTER TABLE `recycle_task`
ADD COLUMN `restore_custom` VARCHAR(64) NULL DEFAULT NULL COMMENT '还原定制化方式' AFTER `recycle_response`;

CREATE TABLE `recycle` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`recycle_module` VARCHAR(32) NOT NULL COMMENT '回收模块',
`recycle_delay_date` DATE NULL DEFAULT NULL COMMENT '回收日期',
`recycle_custom` VARCHAR(64) NULL DEFAULT NULL COMMENT '回收定制化方式',
`recycle_status` TINYINT(4) NULL DEFAULT '0' COMMENT '回收任务状态(0:待删除,1:已删除,2:删除失败,3:删除中,4:还原中,5:已还原)',
`create_user_id` BIGINT(20) NULL DEFAULT NULL COMMENT '创建人ID',
`update_user_id` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人ID',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
`recycle_note` VARCHAR(512) NULL DEFAULT NULL COMMENT '回收说明',
`remark` VARCHAR(512) NULL DEFAULT NULL COMMENT '备注',
`recycle_response` VARCHAR(512) NULL DEFAULT NULL COMMENT '回收响应信息',
`restore_custom` VARCHAR(64) NULL DEFAULT NULL COMMENT '还原定制化方式',
`deleted` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '删除(0正常,1已删除)',
PRIMARY KEY (`id`)
)
COMMENT='垃圾回收任务主表'
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;

CREATE TABLE `recycle_detail` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`recycle_id` BIGINT(20) NOT NULL COMMENT '垃圾回收任务主表ID',
`recycle_type` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '回收类型(0文件,1数据库表数据)',
`recycle_condition` TEXT NOT NULL COMMENT '回收条件(回收表数据sql、回收文件绝对路径)',
`recycle_status` TINYINT(4) NULL DEFAULT '0' COMMENT '回收任务状态(0:待删除,1:已删除,2:删除失败,3:删除中)',
`create_user_id` BIGINT(20) NULL DEFAULT NULL COMMENT '创建人ID',
`update_user_id` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人ID',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
`recycle_note` VARCHAR(512) NULL DEFAULT NULL COMMENT '回收说明',
`remark` VARCHAR(512) NULL DEFAULT NULL COMMENT '备注',
`recycle_response` VARCHAR(512) NULL DEFAULT NULL COMMENT '回收响应信息',
`deleted` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '删除(0正常,1已删除)',
PRIMARY KEY (`id`),
INDEX `recycle_task_main_id` (`recycle_id`)
)
COMMENT='垃圾回收任务详情表'
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;


create table data_file_annotation IF NOT EXISTS data_file_annotation
(
id bigint auto_increment
primary key,
dataset_id bigint not null comment '数据集ID',
label_id bigint not null comment '标签ID',
version_file_id bigint not null comment '版本文件ID',
prediction double default 0 null comment '预测值',
create_user_id bigint null,
create_time datetime default CURRENT_TIMESTAMP not null,
update_user_id bigint null,
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
deleted bit default b'0' not null,
file_name varchar(255) null comment '文件名称'
)
comment '数据集文件标注表';

create index label_dataset_id_indx
on data_file_annotation (label_id, dataset_id);

create index version_file_index
on data_file_annotation (version_file_id);


alter table menu add column back_to varchar(255) default null comment '上级菜单';

alter table menu add column ext_config varchar(255) default null comment '扩展配置';

alter table data_dataset_label add column `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间';
alter table data_dataset_label add column `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间';
alter table data_dataset_label add column `deleted` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '删除(0正常,1已删除)';
alter table data_dataset_label add column create_user_id bigint(20) DEFAULT NULL COMMENT '创建人id';
alter table data_dataset_label add column update_user_id bigint(20) DEFAULT NULL COMMENT '修改人id';

INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 90, 1, '回收站', 'shuju1', 'recycle', 'system/recycle/index', 'SystemRecycle', 'BaseLayout', 'system:recycle', false, false, 999, 1, 1, false, null, null);

ALTER TABLE `model_opt_task` ADD COLUMN `model_branch_id` BIGINT(20) NULL DEFAULT NULL COMMENT '模型对应版本id' AFTER `model_id`;
ALTER TABLE `model_opt_task_instance` ADD COLUMN `model_branch_id` BIGINT(20) NULL DEFAULT NULL COMMENT '模型对应版本id' AFTER `model_id`;

ALTER TABLE `serving_model_config` ADD COLUMN `model_branch_id` BIGINT(20) NULL DEFAULT NULL COMMENT '模型对应版本id' AFTER `model_id`;
ALTER TABLE `serving_batch` ADD COLUMN `model_branch_id` BIGINT(20) NULL DEFAULT NULL COMMENT '模型对应版本id' AFTER `model_id`;

alter table data_dataset
add column source_id bigint(20) default null comment '数据集来源ID';

drop index idx_name_unique on data_dataset;

insert into `pt_auxiliary_info` (`origin_user_id`,`type`,`aux_info`) values (0,'algorithem_usage','模型优化');

update menu set name='算法开发' where id=30;

drop index measure_unidex on pt_measure;
create index user_id
on pt_measure (create_user_id);


delete from pt_train_algorithm where algorithm_name in ('OneFlow预置算法-resnet50','OneFlow预置算法-bert','OneFlow预置算法-alexnet','OneFlow预置算法-mobilenetv2','OneFlow预置算法-dcgan','OneFlow预置算法-vgg16','OneFlow预置算法-insightface','OneFlow预置算法-yolov3','OneFlow预置算法-deep_and_wide');

alter table data_label_group
add column operate_type int(11) default null comment '操作类型';
alter table data_label_group
add column label_group_type int(1) default 0 comment '标签组数据类型 0:视觉 1:文本';



INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '图像语义分割', null, 'datasets/segmentation/:datasetId', 'dataset/annotate', 'SegmentationDataset', 'DatasetLayout', null, true, false, 19, 1, 1, false, null, '{"test": 1}');
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '图像语义分割', null, 'datasets/segmentation/:datasetId/file/:fileId', 'dataset/annotate', 'SegmentationDatasetFile', 'DatasetLayout', null, true, false, 18, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '医学影像阅读', 'beauty', 'datasets/medical/viewer/:medicalId', 'dataset/medical/viewer', 'DatasetMedicalViewer', 'FullpageLayout', null, true, false, 999, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '数据集管理', 'shujuguanli', 'datasets', 'dataset/fork', 'DatasetFork', 'BaseLayout', null, false, false, 17, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '医疗影像数据集', null, 'datasets/medical', 'dataset/medical/list', 'DatasetMedical', 'BaseLayout', null, true, false, 25, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '数据集场景选择', null, 'datasets/entrance', 'dataset/entrance', 'Entrance', 'BaseLayout', null, true, false, 20, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '文本分类', null, 'datasets/textclassify/:datasetId', 'dataset/nlp/textClassify', 'TextClassify', 'DetailLayout', '', true, false, 26, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '文本标注', null, 'datasets/text/annotation/:datasetId', 'dataset/nlp/annotation', 'TextAnnotation', 'DetailLayout', null, true, false, 27, 1, 1, false, null, null);
INSERT INTO menu ( pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '导入表格', null, 'datasets/table/import', 'dataset/tableImport', 'TableImport', 'DetailLayout', null, true, false, 999, 1, 1, false, null, '{}');


INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/segmentation/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/segmentation/:datasetId/file/:fileId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/medical/viewer/:medicalId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/medical'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/entrance'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/textclassify/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/text/annotation/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/table/import'));

INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/segmentation/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/segmentation/:datasetId/file/:fileId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/medical/viewer/:medicalId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/medical'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/entrance'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/textclassify/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/text/annotation/:datasetId'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/table/import'));

update menu set name = '视觉/文本数据集' where name = '视觉文本数据集';


INSERT INTO menu (pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, deleted, back_to, ext_config) VALUES ( 10, 1, '导入表格', null, 'datasets/table/import', 'dataset/tableImport', 'TableImport', 'DetailLayout', null, true, false, 999, 1, 1, false, null, '{}');
INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'datasets/table/import'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'datasets/table/import'));




alter table recycle modify recycle_delay_date DATETIME NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '回收日期';

ALTER TABLE `serving_model_config` ADD COLUMN `image` VARCHAR(255) NULL DEFAULT NULL COMMENT '镜像' AFTER `model_name`;

ALTER TABLE `serving_batch` ADD COLUMN `image` VARCHAR(255) NULL DEFAULT NULL COMMENT '镜像';
ALTER TABLE `serving_model_config`
ADD COLUMN `script_path` VARCHAR(255) NULL DEFAULT NULL COMMENT '推理脚本路径' AFTER `image`,
ADD COLUMN `use_script` BIT(1) NULL DEFAULT b'0' COMMENT '是否使用脚本' AFTER `script_path`;
ALTER TABLE `serving_batch`
ADD COLUMN `script_path` VARCHAR(255) NULL DEFAULT NULL COMMENT '推理脚本路径' AFTER `image`,
ADD COLUMN `use_script` BIT(1) NULL DEFAULT b'0' COMMENT '是否使用脚本' AFTER `script_path`;
ALTER TABLE serving_model_config MODIFY COLUMN deploy_params json NULL DEFAULT NULL COMMENT '部署参数';
alter table serving_batch drop model_config_path;
alter table serving_batch drop reasoning_script_path;

ALTER TABLE `pt_model_info`
MODIFY COLUMN model_description varchar(255) null comment '模型描述';

INSERT INTO `menu`(`id`, `pid`, `type`, `name`, `icon`, `path`, `component`, `component_name`, `layout`, `hidden`, `permission`) VALUES
(45, 40, 1, '可视化任务', 'mobanguanli', 'visual', 'trainingJob/trainingVisualList', 'TrainVisual', 'BaseLayout', b'0', 'training:visual');

alter table pt_train_algorithm
add column inference tinyint(1) default 0 not null comment '算法文件是否可推理(1可推理,0不可推理)';

ALTER TABLE `serving_model_config`
ADD COLUMN `image_name` VARCHAR(255) NULL DEFAULT NULL COMMENT '镜像名称' AFTER `image`,
ADD COLUMN `image_tag` VARCHAR(255) NULL DEFAULT NULL COMMENT '镜像版本' AFTER `image_name`;

ALTER TABLE `serving_batch`
ADD COLUMN `image_name` VARCHAR(255) NULL DEFAULT NULL COMMENT '镜像名称' COLLATE 'utf8_general_ci' AFTER `image`,
ADD COLUMN `image_tag` VARCHAR(255) NULL DEFAULT NULL COMMENT '镜像版本' COLLATE 'utf8_general_ci' AFTER `image_name`;


ALTER TABLE `serving_batch`
ADD COLUMN `algorithm_id` INT NULL DEFAULT NULL COMMENT '算法ID' AFTER `use_script`;

ALTER TABLE `serving_model_config`
ADD COLUMN `algorithm_id` INT NULL DEFAULT NULL COMMENT '算法ID' AFTER `use_script`;

ALTER TABLE `serving_batch`
ADD COLUMN `origin_user_id` BIGINT(20) NULL DEFAULT NULL COMMENT '资源用有人ID';

ALTER TABLE `serving_info`
ADD COLUMN `origin_user_id` BIGINT(20) NULL DEFAULT NULL COMMENT '资源用有人ID';

ALTER TABLE `model_opt_task`
ADD COLUMN `origin_user_id` BIGINT(20) NULL DEFAULT NULL COMMENT '资源用有人ID';

ALTER TABLE `model_opt_task_instance`
ADD COLUMN `origin_user_id` BIGINT(20) NULL DEFAULT NULL COMMENT '资源用有人ID';

create table if not exists pt_model_type
(
id bigint auto_increment comment '主键'
primary key,
frame_type tinyint not null comment '框架类型',
model_type varchar(255) not null comment '模型文件的格式',
create_user_id bigint null comment '创建用户ID',
update_user_id bigint null comment '更新用户ID',
deleted bit default b'0' not null comment '0 正常,1 已删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
origin_user_id bigint null comment '资源用有人ID'
)
comment '模型格式' charset = utf8;

update dict_detail set label='oneflow' where dict_id=6 and sort=1;
update dict_detail set label='tensorflow' where dict_id=6 and sort=2;
update dict_detail set label='pytorch' where dict_id=6 and sort=3;
update dict_detail set label='keras' where dict_id=6 and sort=4;
update dict_detail set label='caffe' where dict_id=6 and sort=5;
update dict_detail set label='blade' where dict_id=6 and sort=6;
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (6, 'mxnet', '7', 7);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (7, 'pb', '9', 9);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (7, 'ckpt', '10', 10);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (7, 'pkt', '11', 11);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (7, 'pt', '12', 12);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (7, 'h5(HDF5)', '13', 13);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (7, 'caffemodel', '14', 14);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (7, 'params', '15', 15);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (7, 'json', '16', 16);

INSERT INTO `pt_model_type`(`frame_type`, `model_type`) VALUES (1, '1');
INSERT INTO `pt_model_type`(`frame_type`, `model_type`) VALUES (2, '1,9,10');
INSERT INTO `pt_model_type`(`frame_type`, `model_type`) VALUES (3, '8,11,12');
INSERT INTO `pt_model_type`(`frame_type`, `model_type`) VALUES (4, '13');
INSERT INTO `pt_model_type`(`frame_type`, `model_type`) VALUES (5, '4,14');
INSERT INTO `pt_model_type`(`frame_type`, `model_type`) VALUES (6, '6');
INSERT INTO `pt_model_type`(`frame_type`, `model_type`) VALUES (7, '15,16');

create table if not exists pt_model_suffix
(
id bigint auto_increment comment '主键'
primary key,
model_type tinyint not null comment '模型文件的格式',
model_suffix varchar(255) default '' not null comment '模型文件的格式对应后缀名',
create_user_id bigint null comment '创建用户ID',
update_user_id bigint null comment '更新用户ID',
deleted bit default b'0' not null comment '0 正常,1 已删除',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
origin_user_id bigint null comment '资源用有人ID'
)
comment '模型后缀名' charset = utf8;
INSERT INTO `pt_model_suffix`(`model_type`) VALUES (1);
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (2, '.pb');
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (3, '.h5');
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (4, '.caffeprototxt');
INSERT INTO `pt_model_suffix`(`model_type`) VALUES (5);
INSERT INTO `pt_model_suffix`(`model_type`) VALUES (6);
INSERT INTO `pt_model_suffix`(`model_type`) VALUES (7);
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (8, '.pth');
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (9, '.pb');
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (10, '.ckpt');
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (11, '.pkt');
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (12, '.pt');
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (13, '.h5');
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (14, '.caffemodel');
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (15, '.params');
INSERT INTO `pt_model_suffix`(`model_type`, `model_suffix`) VALUES (16, '.json');

INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (7, 'Directory', '17', 17);
update pt_model_type set model_type='1,17' where frame_type=1;
update pt_model_type set model_type='1,13' where frame_type=4;
alter table pt_image modify image_tag varchar(64) not null comment '镜像版本';

CREATE TABLE if not exists `permission` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`pid` bigint(20) NOT NULL DEFAULT '0' COMMENT '父id',
`name` varchar(64) DEFAULT NULL COMMENT '菜单/操作按钮名称',
`permission` varchar(128) DEFAULT NULL COMMENT '权限标识',
`create_user_id` bigint(20) DEFAULT NULL COMMENT '创建人id',
`update_user_id` bigint(20) DEFAULT NULL COMMENT '修改人id',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0' COMMENT '删除标记 0正常,1已删除',
PRIMARY KEY (`id`)
)
ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='权限表';

create table if not exists `roles_auth`(
role_id bigint not null,
auth_id bigint null
)ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='角色权限关联表';

CREATE TABLE if not exists `pt_group`
(
id BIGINT(20) not null auto_increment primary key,
name varchar(32) default null comment '用户组名称',
description varchar(255) default null comment '备注',
create_user_id bigint null comment '创建人id',
update_user_id bigint null comment '修改人id',
create_time datetime default CURRENT_TIMESTAMP null,
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP,
deleted bit default b'0' null comment '删除标记 0正常,1已删除'
) ENGINE = InnoDB
DEFAULT CHARSET = utf8
ROW_FORMAT = DYNAMIC COMMENT ='用户组表';
create unique index group_name_uindex
on pt_group (name);

create table if not exists `user_group`(
group_id BIGINT(20) not null comment '用户组id',
user_id bigint(20) not null comment '用户id'
)
comment '用户组-用户关联表' charset =utf8;
create index group_user_group_id
on user_group (group_id);

create unique index group_user_user_id
on user_group (user_id);

create table if not exists `auth`(
id bigint auto_increment
primary key,
auth_code varchar(32) not null comment '权限code',
description varchar(255) null comment '描述',
create_user_id bigint null comment '创建人id',
update_user_id bigint null comment '修改人id',
create_time datetime default CURRENT_TIMESTAMP null,
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP,
deleted bit default b'0' null comment '删除标记 0正常,1已删除'
)
comment '权限管理表';

create index auth_index_auth_code
on auth (auth_code);

create table if not exists `auth_permission`
(
auth_id bigint not null,
permission_id bigint not null
)
comment '权限组-权限关联表';

INSERT INTO menu (pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, create_time, update_time, deleted, back_to, ext_config) VALUES (90, 1, '用户组管理', 'tuanduiguanli-tuanduiguanli', 'userGroup', 'system/userGroup', 'UserGroup', 'BaseLayout', 'system:userGroup', false, false, 91, 3, 3, '2021-05-11 09:32:32', '2021-05-11 09:32:32', false, null, '{}');
INSERT INTO menu (pid, type, name, icon, path, component, component_name, layout, permission, hidden, cache, sort, create_user_id, update_user_id, create_time, update_time, deleted, back_to, ext_config) VALUES (90, 1, '权限管理', 'fuwuguanli', 'authCode', 'system/authCode', 'AuthCode', 'BaseLayout', 'authCode', false, false, 92, 1, 3, '2021-05-19 09:16:32', '2021-05-19 09:19:44', false, null, '{}');

INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'userGroup'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'userGroup'));

INSERT INTO roles_menus (role_id, menu_id) value (1, (select id from menu where path = 'authCode'));
INSERT INTO roles_menus (role_id, menu_id) value (2, (select id from menu where path = 'authCode'));

alter table pt_train_job change out_path model_path varchar(128) default '' null comment '训练模型输出路径';
alter table pt_train_job change log_path out_path varchar(128) default '' null comment '训练输出路径';
alter table pt_train_algorithm change is_train_out is_train_model_out tinyint(1) default 1 null comment '是否输出训练结果:1是,0否';
alter table pt_train_algorithm change is_train_log is_train_out tinyint(1) default 1 null comment '是否输出训练信息:1是,0否';

ALTER TABLE `data_task` ADD COLUMN `version_name` varchar(255) NULL COMMENT '转预置版本号';
ALTER TABLE `data_task` ADD COLUMN `target_id` bigint(20) NULL COMMENT '目标数据集id';

create table if not exists resource_specs
(
id int auto_increment comment '主键ID'
primary key,
specs_name varchar(128) default '' not null comment '规格名称',
resources_pool_type tinyint(1) default 0 not null comment '规格类型(0为CPU, 1为GPU)',
module int not null comment '所属业务场景(0:通用,1:dubhe-notebook,2:dubhe-train,3:dubhe-serving)',
cpu_num int not null comment 'CPU数量,单位:核',
gpu_num int not null comment 'GPU数量,单位:核',
mem_num int not null comment '内存大小,单位:M',
workspace_request int not null comment '工作空间的存储配额,单位:M',
create_user_id bigint null comment '创建人',
create_time timestamp null comment '创建时间',
update_user_id bigint null comment '更新人',
update_time timestamp null comment '更新时间',
deleted tinyint(1) default 0 not null comment '删除(0正常,1已删除)'
)
comment '资源规格';

INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (4, '调度中', 'Pending', 2);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (4, '运行完成', 'Succeeded', 3);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (4, '已删除', 'Deleted', 4);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (4, '运行失败', 'Failed', 5);
INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (4, '未知状态', 'Unknown', 6);

alter table notebook MODIFY COLUMN cpu_num INT(11) NOT NULL DEFAULT '0' COMMENT 'CPU数量(核)';
alter table notebook MODIFY COLUMN gpu_num INT(11) NOT NULL DEFAULT '0' COMMENT 'GPU数量(核)';
alter table notebook MODIFY COLUMN mem_num INT(11) NOT NULL DEFAULT '0' COMMENT '内存大小(M)';
alter table notebook MODIFY COLUMN disk_mem_num INT(11) NOT NULL DEFAULT '0' COMMENT '硬盘内存大小(M)';

ALTER TABLE `pt_train_job`
ADD COLUMN `status_detail` json NULL DEFAULT NULL COMMENT '状态对应的详情信息';
ALTER TABLE `notebook`
ADD COLUMN `status_detail` json NULL DEFAULT NULL COMMENT '状态对应的详情信息';

ALTER TABLE `serving_batch`
ADD COLUMN `status_detail` json NULL DEFAULT NULL COMMENT '状态对应的详情信息' AFTER `status` ;
ALTER TABLE `serving_info`
ADD COLUMN `status_detail` json NULL DEFAULT NULL COMMENT '状态对应的详情信息' AFTER `status` ;
ALTER TABLE `model_opt_task_instance`
ADD COLUMN `status_detail` json NULL DEFAULT NULL COMMENT '状态对应的详情信息' AFTER `status` ;

INSERT INTO `dict_detail`(`dict_id`, `label`, `value`, `sort`) VALUES (9, '模型转换', '3', 4);

INSERT INTO `menu`( `pid`, `type`, `name`, `icon`, `path`, `component`, `component_name`, `layout`, `hidden`, `permission`) VALUES
(90, 1, '资源规格管理','xunlianzhunbei','resources','system/resources','Resources','BaseLayout',b'0','system:specs');

INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('1CPU2GB内存',0,1,1,0,2048,500);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('2CPU4GB内存',0,1,2,0,2048,500);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('1CPU2GB内存 1GPU',1,1,1,1,2048,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('1CPU2GB内存 2GPU',1,1,1,2,2048,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('2CPU4GB内存 1GPU',1,1,2,1,4096,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('2CPU4GB内存 2GPU',1,1,2,2,4096,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('4CPU16GB内存 2GPU',1,1,16,2,16000,4096);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('4CPU16GB内存 4GPU',1,1,16,4,16000,4096);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('8CPU64GB内存 2GPU',1,1,8,2,64000,4096);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('16CPU128GB内存 4GPU',1,1,16,4,128000,50000);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('32CPU256GB内存 8GPU',1,1,32,8,256000,50000);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('1CPU2GB内存',0,2,1,0,2048,500);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('2CPU4GB内存',0,2,2,0,2048,500);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('1CPU2GB内存 1GPU',1,2,1,1,2048,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('1CPU2GB内存 2GPU',1,2,1,2,2048,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('2CPU4GB内存 1GPU',1,2,2,1,4096,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('2CPU4GB内存 2GPU',1,2,2,2,4096,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('4CPU16GB内存 2GPU',1,2,16,2,16000,4096);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('4CPU16GB内存 4GPU',1,2,16,4,16000,4096);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('8CPU64GB内存 2GPU',1,2,8,2,64000,4096);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('16CPU128GB内存 4GPU',1,2,16,4,128000,50000);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('32CPU256GB内存 8GPU',1,2,32,8,256000,50000);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('1CPU2GB内存',0,3,1,0,2048,500);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('2CPU4GB内存',0,3,2,0,2048,500);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('1CPU2GB内存 1GPU',1,3,1,1,2048,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('1CPU2GB内存 2GPU',1,3,1,2,2048,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('2CPU4GB内存 1GPU',1,3,2,1,4096,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('2CPU4GB内存 2GPU',1,3,2,2,4096,2048);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('4CPU16GB内存 2GPU',1,3,16,2,16000,4096);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('4CPU16GB内存 4GPU',1,3,16,4,16000,4096);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('8CPU64GB内存 2GPU',1,3,8,2,64000,4096);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('16CPU128GB内存 4GPU',1,3,16,4,128000,50000);
INSERT INTO resource_specs(specs_name,resources_pool_type,module,cpu_num,gpu_num,mem_num,workspace_request) value
('32CPU256GB内存 8GPU',1,3,32,8,256000,50000);

--删除无效的资源规格表
drop table notebook_model;
drop table pt_train_job_specs;

update menu set permission='atlas:measure' where name='度量管理';

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '控制台', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '用户管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建用户', 'system:user:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑用户', 'system:user:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除用户', 'system:user:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '用户组管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建用户组', 'system:userGroup:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑用户组', 'system:userGroup:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除用户组', 'system:userGroup:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑成员', 'system:userGroup:editUser', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '批量修改角色', 'system:userGroup:editUserRole', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '批量激活锁定', 'system:userGroup:editUserState', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '批量删除用户', 'system:userGroup:deleteUser', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '权限管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建权限组', 'system:authCode:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑权限组', 'system:authCode:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除权限`组', 'system:authCode:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建权限', 'system:permission:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑权限', 'system:permission:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除权限', 'system:permission:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '角色管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建角色', 'system:role:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑角色', 'system:role:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除角色', 'system:role:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '权限分配', 'system:role:auth', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '菜单分配', 'system:role:menu', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '菜单管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除菜单', 'system:menu:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑菜单', 'system:menu:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建菜单', 'system:menu:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '字典管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建字典', 'system:dict:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑字典', 'system:dict:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除字典', 'system:dict:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '字典详情-创建', 'system:dictDetail:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '字典详情-修改', 'system:dictDetail:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '字典详情-删除', 'system:dictDetail:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '资源规格管理', 1, 1 from permission where name='控制台';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建资源规格', 'system:specs:create', 1, 1 );
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改资源规格', 'system:specs:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除资源规格', 'system:specs:delete', 1, 1);

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '算法开发', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '算法管理', 1, 1 from permission where name='算法开发';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建算法', 'development:algorithm:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改算法', 'development:algorithm:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除算法', 'development:algorithm:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, 'notebook', 1, 1 from permission where name='算法开发';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建notebook', 'notebook:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改notebook', 'notebook:update', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '打开notebook', 'notebook:open', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '启动notebook', 'notebook:start', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '停止notebook', 'notebook:stop', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除notebook', 'notebook:delete', 1, 1);

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '模型管理', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '模型列表', 1, 1 from permission where name='模型管理';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型列表-创建', 'model:model:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型列表-修改', 'model:model:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型列表-删除', 'model:model:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '模型优化', 1, 1 from permission where name='模型管理';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建任务', 'model:optimize:createTask', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '提交任务', 'model:optimize:submitTask', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改任务', 'model:optimize:editTask', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除任务', 'model:optimize:deleteTask', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '提交任务实例', 'model:optimize:submitTaskInstance', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '取消任务实例实例', 'model:optimize:cancelTaskInstance', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除任务实例', 'model:optimize:deleteTaskInstance', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '模型版本管理', 1, 1 from permission where name='模型管理';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型版本管理-创建', 'model:branch:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型版本管理-删除', 'model:branch:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型版本管理-转预置', 'model:branch:convertPreset', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '模型版本管理-转onnx', 'model:branch:convertOnnx', 1, 1);

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '训练管理', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '镜像管理', 1, 1 from permission where name='训练管理';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '上传镜像', 'training:image:upload', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改镜像', 'training:image:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除镜像', 'training:image:delete', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '训练任务', 1, 1 from permission where name='训练管理';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建训练', 'training:job:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改训练', 'training:job:update', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除训练', 'training:job:delete', 1, 1);

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '云端serving', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '在线服务', 1, 1 from permission where name='云端serving';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建服务', 'serving:online:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改服务', 'serving:online:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除服务', 'serving:online:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '启动服务', 'serving:online:start', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '停止服务', 'serving:online:stop', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '批量服务', 1, 1 from permission where name='云端serving';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建批量任务', 'serving:batch:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '修改批量服务', 'serving:batch:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除批量服务', 'serving:batch:delete', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '启动批量服务', 'serving:batch:start', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '停止批量服务', 'serving:batch:stop', 1, 1);

insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) VALUES (0, '模型炼知', 1, 1);
insert into `permission` (`pid`, `name`, `create_user_id`, `update_user_id`) select id, '度量管理', 1, 1 from permission where name='模型炼知';
select @pid := @@IDENTITY;
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '创建度量', 'atlas:measure:create', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '编辑度量', 'atlas:measure:edit', 1, 1);
insert into `permission` (`pid`, `name`, `permission`, `create_user_id`, `update_user_id`) values (@pid, '删除度量', 'atlas:measure:delete', 1, 1);

insert into auth(id, auth_code, description, create_user_id, update_user_id) values (1, 'admin权限组', '默认全部操作权限', 1, 1);
insert into auth_permission (auth_id, permission_id) select 1, id from permission;
INSERT INTO `roles_auth` (role_id, auth_id) values (1, 1);

update menu set permission='model:branch' where name='模型版本管理';

alter table pt_train_param change out_path model_path varchar(128) default '' null comment '模型输出路径';
alter table pt_train_param change log_path out_path varchar(128) default '' null comment '输出路径';

+ 3154
- 555
dubhe-server/sql/10-Dubhe-Boot-Update-Cloud.sql
File diff suppressed because it is too large
View File


Loading…
Cancel
Save