You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/03/10 01:44:57 UTC

[incubator-linkis] 10/10: format of ddl and dml

This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.1.0-datasource
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git

commit d445db0a406a24ec148b2c566484870bfbc9d95b
Author: casionone <ca...@gmail.com>
AuthorDate: Wed Mar 9 21:50:07 2022 +0800

    format of ddl and dml
---
 db/linkis_ddl.sql | 46 ++++++++++++++--------------------------------
 db/linkis_dml.sql | 38 ++++++++++++++++++++------------------
 2 files changed, 34 insertions(+), 50 deletions(-)

diff --git a/db/linkis_ddl.sql b/db/linkis_ddl.sql
index 393badf..7dfddd6 100644
--- a/db/linkis_ddl.sql
+++ b/db/linkis_ddl.sql
@@ -416,7 +416,7 @@ CREATE TABLE `linkis_ps_cs_context_listener` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
 
-drop table if exists `linkis_ps_bml_resources`;
+DROP TABLE IF EXISTS `linkis_ps_bml_resources`;
 CREATE TABLE if not exists `linkis_ps_bml_resources` (
   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
   `resource_id` varchar(50) NOT NULL COMMENT 'resource uuid',
@@ -437,7 +437,7 @@ CREATE TABLE if not exists `linkis_ps_bml_resources` (
 ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4;
 
 
-drop table if exists `linkis_ps_bml_resources_version`;
+DROP TABLE IF EXISTS `linkis_ps_bml_resources_version`;
 CREATE TABLE if not exists `linkis_ps_bml_resources_version` (
   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
   `resource_id` varchar(50) NOT NULL COMMENT 'Resource uuid',
@@ -459,7 +459,7 @@ CREATE TABLE if not exists `linkis_ps_bml_resources_version` (
 
 
 
-drop table if exists `linkis_ps_bml_resources_permission`;
+DROP TABLE IF EXISTS `linkis_ps_bml_resources_permission`;
 CREATE TABLE if not exists `linkis_ps_bml_resources_permission` (
   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
   `resource_id` varchar(50) NOT NULL COMMENT 'Resource uuid',
@@ -473,7 +473,7 @@ CREATE TABLE if not exists `linkis_ps_bml_resources_permission` (
 
 
 
-drop table if exists `linkis_ps_resources_download_history`;
+DROP TABLE IF EXISTS `linkis_ps_resources_download_history`;
 CREATE TABLE if not exists `linkis_ps_resources_download_history` (
   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
 	`start_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'start time',
@@ -490,7 +490,7 @@ CREATE TABLE if not exists `linkis_ps_resources_download_history` (
 
 
 -- 创建资源任务表,包括上传,更新,下载
-drop table if exists `linkis_ps_bml_resources_task`;
+DROP TABLE IF EXISTS `linkis_ps_bml_resources_task`;
 CREATE TABLE if not exists `linkis_ps_bml_resources_task` (
   `id` bigint(20) NOT NULL AUTO_INCREMENT,
   `resource_id` varchar(50) DEFAULT NULL COMMENT 'resource uuid',
@@ -511,7 +511,7 @@ CREATE TABLE if not exists `linkis_ps_bml_resources_task` (
 
 
 
-drop table if exists linkis_ps_bml_project;
+DROP TABLE IF EXISTS `linkis_ps_bml_project`;
 create table if not exists linkis_ps_bml_project(
   `id` int(10) NOT NULL AUTO_INCREMENT,
   `name` varchar(128) DEFAULT NULL,
@@ -527,7 +527,7 @@ PRIMARY KEY (`id`)
 
 
 
-drop table if exists linkis_ps_bml_project_user;
+DROP TABLE IF EXISTS `linkis_ps_bml_project_user`;
 create table if not exists linkis_ps_bml_project_user(
   `id` int(10) NOT NULL AUTO_INCREMENT,
   `project_id` int(10) NOT NULL,
@@ -541,7 +541,7 @@ PRIMARY KEY (`id`)
 )ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=COMPACT;
 
 
-drop table if exists linkis_ps_bml_project_resource;
+DROP TABLE IF EXISTS `linkis_ps_bml_project_resource`;
 create table if not exists linkis_ps_bml_project_resource(
   `id` int(10) NOT NULL AUTO_INCREMENT,
   `project_id` int(10) NOT NULL,
@@ -609,7 +609,6 @@ CREATE TABLE `linkis_ps_error_code` (
 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 DROP TABLE IF EXISTS `linkis_cg_manager_service_instance`;
-
 CREATE TABLE `linkis_cg_manager_service_instance` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `instance` varchar(128) COLLATE utf8_bin DEFAULT NULL,
@@ -625,7 +624,6 @@ CREATE TABLE `linkis_cg_manager_service_instance` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 DROP TABLE IF EXISTS `linkis_cg_manager_linkis_resources`;
-
 CREATE TABLE `linkis_cg_manager_linkis_resources` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `max_resource` varchar(255) COLLATE utf8_bin DEFAULT NULL,
@@ -644,7 +642,6 @@ CREATE TABLE `linkis_cg_manager_linkis_resources` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 DROP TABLE IF EXISTS `linkis_cg_manager_lock`;
-
 CREATE TABLE `linkis_cg_manager_lock` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `lock_object` varchar(255) COLLATE utf8_bin DEFAULT NULL,
@@ -676,7 +673,6 @@ CREATE TABLE `linkis_cg_manager_engine_em` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 DROP TABLE IF EXISTS `linkis_cg_manager_label`;
-
 CREATE TABLE `linkis_cg_manager_label` (
   `id` int(20) NOT NULL AUTO_INCREMENT,
   `label_key` varchar(32) COLLATE utf8_bin NOT NULL,
@@ -690,7 +686,6 @@ CREATE TABLE `linkis_cg_manager_label` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 DROP TABLE IF EXISTS `linkis_cg_manager_label_value_relation`;
-
 CREATE TABLE `linkis_cg_manager_label_value_relation` (
   `id` int(20) NOT NULL AUTO_INCREMENT,
   `label_value_key` varchar(255) COLLATE utf8_bin NOT NULL,
@@ -736,7 +731,6 @@ CREATE TABLE `linkis_cg_manager_label_user` (
 
 
 DROP TABLE IF EXISTS `linkis_cg_manager_metrics_history`;
-
 CREATE TABLE `linkis_cg_manager_metrics_history` (
   `id` int(20) NOT NULL AUTO_INCREMENT,
   `instance_status` int(20) DEFAULT NULL,
@@ -752,7 +746,6 @@ CREATE TABLE `linkis_cg_manager_metrics_history` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 DROP TABLE IF EXISTS `linkis_cg_manager_service_instance_metrics`;
-
 CREATE TABLE `linkis_cg_manager_service_instance_metrics` (
   `instance` varchar(128) COLLATE utf8_bin NOT NULL,
   `instance_status` int(11) DEFAULT NULL,
@@ -777,7 +770,7 @@ CREATE TABLE `linkis_cg_engine_conn_plugin_bml_resources` (
   `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'created time',
   `last_update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'updated time',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 -- ----------------------------
 -- Table structure for linkis_ps_dm_datasource
@@ -801,9 +794,7 @@ CREATE TABLE `linkis_ps_dm_datasource`
     `expire`               tinyint(1)                         DEFAULT 0,
     `published_version_id` int(11)                            DEFAULT NULL,
     PRIMARY KEY (`id`)
-) ENGINE = InnoDB
-  CHARACTER SET = utf8
-  COLLATE = utf8_bin;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 -- ----------------------------
 -- Table structure for linkis_ps_dm_datasource_env
@@ -821,9 +812,7 @@ CREATE TABLE `linkis_ps_dm_datasource_env`
     `modify_time`        datetime                      NOT NULL DEFAULT CURRENT_TIMESTAMP,
     `modify_user`        varchar(255) COLLATE utf8_bin NULL     DEFAULT NULL,
     PRIMARY KEY (`id`)
-) ENGINE = InnoDB
-  CHARACTER SET = utf8
-  COLLATE = utf8_bin;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 
 -- ----------------------------
@@ -840,9 +829,7 @@ CREATE TABLE `linkis_ps_dm_datasource_type`
     `icon`        varchar(255) COLLATE utf8_bin DEFAULT NULL,
     `layers`      int(3)                       NOT NULL,
     PRIMARY KEY (`id`)
-) ENGINE = InnoDB
-  CHARACTER SET = utf8
-  COLLATE = utf8_bin;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 -- ----------------------------
 -- Table structure for linkis_ps_dm_datasource_type_key
@@ -866,10 +853,7 @@ CREATE TABLE `linkis_ps_dm_datasource_type_key`
     `update_time`         datetime                      NOT NULL DEFAULT CURRENT_TIMESTAMP,
     `create_time`         datetime                      NOT NULL DEFAULT CURRENT_TIMESTAMP,
     PRIMARY KEY (`id`)
-) ENGINE = InnoDB
-  CHARACTER SET = utf8
-  COLLATE = utf8_bin;
-
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 -- ----------------------------
 -- Table structure for linkis_ps_dm_datasource_version
 -- ----------------------------
@@ -883,6 +867,4 @@ CREATE TABLE `linkis_ps_dm_datasource_version`
     `create_time`   datetime(0)                    NULL DEFAULT CURRENT_TIMESTAMP,
     `create_user`   varchar(255) COLLATE utf8_bin  NULL DEFAULT NULL,
     PRIMARY KEY (`version_id`, `datasource_id`) USING BTREE
-) ENGINE = InnoDB
-  CHARACTER SET = utf8
-  COLLATE = utf8_bin;
\ No newline at end of file
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
\ No newline at end of file
diff --git a/db/linkis_dml.sql b/db/linkis_dml.sql
index fb62648..124e180 100644
--- a/db/linkis_dml.sql
+++ b/db/linkis_dml.sql
@@ -317,21 +317,23 @@ INSERT INTO linkis_ps_error_code (error_code,error_desc,error_regex,error_type)
 INSERT INTO linkis_ps_error_code (error_code,error_desc,error_regex,error_type) VALUES ('95005','未配置代理用户,请在ITSM走WTSS用户变更单,为你的用户授权改代理用户','请联系系统管理员为您的用户添加该代理用户',0);
 INSERT INTO linkis_ps_error_code (error_code,error_desc,error_regex,error_type) VALUES ('60079','所查库表无权限','Authorization failed:No privilege',0);
 INSERT INTO linkis_ps_error_code (error_code,error_desc,error_regex,error_type) VALUES ('30002','启动引擎超时,您可以进行任务重试','wait for DefaultEngineConn',0);
-INSERT INTO `linkis_ps_dm_datasource_type` VALUES
-(1,'mysql','mysql数据库','mysql数据库','关系型数据库','',3),
-(2,'kafka','kafka','kafka','消息队列','',2),
-(3,'presto','presto SQL','presto','大数据存储','',3),
-(4,'hive','hive数据库','hive','大数据存储','',3),
-(6,'mongodb','default','default','DEFAULT',NULL,3);
-
-INSERT INTO `linkis_ps_dm_datasource_type_key` VALUES
-(1,1,'host','Host',NULL,'TEXT',NULL,1,'mysql Host ',NULL,NULL,NULL,NULL,'2021-04-08 03:13:36','2021-04-08 03:13:36'),
-(2,1,'port','端口',NULL,'TEXT',NULL,1,'端口',NULL,NULL,NULL,NULL,'2021-04-17 03:10:28','2021-04-17 03:10:28'),
-(3,1,'params','连接参数',NULL,'TEXT',NULL,0,'输入JSON格式: {\"param\":\"value\"}',NULL,NULL,NULL,NULL,'2021-12-06 10:35:00','2021-12-06 10:35:00'),
-(9,1,'username','用户名',NULL,'TEXT',NULL,1,'用户名','^[0-9A-Za-z_-]+$',NULL,NULL,NULL,'2021-04-12 01:54:39','2021-04-12 01:54:39'),
-(10,1,'password','密码',NULL,'PASSWORD',NULL,1,'密码','',NULL,NULL,NULL,'2021-04-12 01:54:39','2021-04-12 01:54:39'),
-(11,4,'envId','集群环境',NULL,'SELECT',NULL,1,'集群环境',NULL,NULL,NULL,'/api/rest_j/v1/data-source-manager/env-list/all/type/4','2021-05-12 03:03:34','2021-05-12 03:03:34');
-
-INSERT INTO `linkis_ps_dm_datasource_env` VALUES
-(1,'测试环境SIT','测试环境SIT',4,'{\"uris\":\"thrift://localhost:9083\", \"hadoopConf\":{\"hive.metastore.execute.setugi\":\"true\"}}','2021-10-26 14:57:29',NULL,'2021-10-26 14:57:29',NULL),
-(2,'测试环境UAT','测试环境UAT',4,'{\"uris\":\"thrift://localhost:9083\", \"hadoopConf\":{\"hive.metastore.execute.setugi\":\"true\"}}','2022-01-04 17:24:20',NULL,'2022-01-04 17:24:20',NULL);
+
+
+INSERT INTO `linkis_ps_dm_datasource_type` (`name`, `description`, `option`, `classifier`, `icon`, `layers`) VALUES ('mysql', 'mysql数据库', 'mysql数据库', '关系型数据库', '', 3);
+INSERT INTO `linkis_ps_dm_datasource_type` (`name`, `description`, `option`, `classifier`, `icon`, `layers`) VALUES ('kafka', 'kafka', 'kafka', '消息队列', '', 2);
+INSERT INTO `linkis_ps_dm_datasource_type` (`name`, `description`, `option`, `classifier`, `icon`, `layers`) VALUES ('presto', 'presto SQL', 'presto', '大数据存储', '', 3);
+INSERT INTO `linkis_ps_dm_datasource_type` (`name`, `description`, `option`, `classifier`, `icon`, `layers`) VALUES ('hive', 'hive数据库', 'hive', '大数据存储', '', 3);
+INSERT INTO `linkis_ps_dm_datasource_type` (`name`, `description`, `option`, `classifier`, `icon`, `layers`) VALUES ('mongodb', 'default', 'default', 'DEFAULT', NULL, 3);
+
+
+INSERT INTO `linkis_ps_dm_datasource_type_key` (`data_source_type_id`, `key`, `name`, `default_value`, `value_type`, `scope`, `require`, `description`, `value_regex`, `ref_id`, `ref_value`, `data_source`, `update_time`, `create_time`) VALUES (1, 'host', 'Host', NULL, 'TEXT', NULL, 1, 'mysql Host ', NULL, NULL, NULL, NULL,  now(), now());
+INSERT INTO `linkis_ps_dm_datasource_type_key` (`data_source_type_id`, `key`, `name`, `default_value`, `value_type`, `scope`, `require`, `description`, `value_regex`, `ref_id`, `ref_value`, `data_source`, `update_time`, `create_time`) VALUES (1, 'port', '端口', NULL, 'TEXT', NULL, 1, '端口', NULL, NULL, NULL, NULL,  now(), now());
+INSERT INTO `linkis_ps_dm_datasource_type_key` (`data_source_type_id`, `key`, `name`, `default_value`, `value_type`, `scope`, `require`, `description`, `value_regex`, `ref_id`, `ref_value`, `data_source`, `update_time`, `create_time`) VALUES (1, 'params', '连接参数', NULL, 'TEXT', NULL, 0, '输入JSON格式: {"param":"value"}', NULL, NULL, NULL, NULL,  now(), now());
+INSERT INTO `linkis_ps_dm_datasource_type_key` (`data_source_type_id`, `key`, `name`, `default_value`, `value_type`, `scope`, `require`, `description`, `value_regex`, `ref_id`, `ref_value`, `data_source`, `update_time`, `create_time`) VALUES (1, 'username', '用户名', NULL, 'TEXT', NULL, 1, '用户名', '^[0-9A-Za-z_-]+$', NULL, NULL, NULL,  now(), now());
+INSERT INTO `linkis_ps_dm_datasource_type_key` (`data_source_type_id`, `key`, `name`, `default_value`, `value_type`, `scope`, `require`, `description`, `value_regex`, `ref_id`, `ref_value`, `data_source`, `update_time`, `create_time`) VALUES (1, 'password', '密码', NULL, 'PASSWORD', NULL, 1, '密码', '', NULL, NULL, NULL,  now(), now());
+INSERT INTO `linkis_ps_dm_datasource_type_key` (`data_source_type_id`, `key`, `name`, `default_value`, `value_type`, `scope`, `require`, `description`, `value_regex`, `ref_id`, `ref_value`, `data_source`, `update_time`, `create_time`) VALUES (4, 'envId', '集群环境', NULL, 'SELECT', NULL, 1, '集群环境', NULL, NULL, NULL, '/api/rest_j/v1/data-source-manager/env-list/all/type/4', now(), now());
+
+
+INSERT INTO `linkis_ps_dm_datasource_env` (`env_name`, `env_desc`, `datasource_type_id`, `parameter`, `create_time`, `create_user`, `modify_time`, `modify_user`) VALUES ('测试环境SIT', '测试环境SIT', 4, '{"uris":"thrift://localhost:9083", "hadoopConf":{"hive.metastore.execute.setugi":"true"}}',  now(), NULL,  now(), NULL);
+INSERT INTO `linkis_ps_dm_datasource_env` (`env_name`, `env_desc`, `datasource_type_id`, `parameter`, `create_time`, `create_user`, `modify_time`, `modify_user`) VALUES ('测试环境UAT', '测试环境UAT', 4, '{"uris":"thrift://localhost:9083", "hadoopConf":{"hive.metastore.execute.setugi":"true"}}',  now(), NULL,  now(), NULL);
+

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org