xiangzihao
3 months ago
committed by
GitHub
82 changed files with 22 additions and 6919 deletions
@ -1,618 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
/* |
|
||||||
Navicat MySQL Data Transfer |
|
||||||
|
|
||||||
Source Server : xx.xx |
|
||||||
Source Server Version : 50725 |
|
||||||
Source Host : 192.168.xx.xx:3306 |
|
||||||
Source Database : escheduler |
|
||||||
|
|
||||||
Target Server Type : MYSQL |
|
||||||
Target Server Version : 50725 |
|
||||||
File Encoding : 65001 |
|
||||||
|
|
||||||
Date: 2019-03-23 11:47:30 |
|
||||||
*/ |
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS=0; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_alert |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_alert`; |
|
||||||
CREATE TABLE `t_escheduler_alert` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`title` varchar(64) DEFAULT NULL COMMENT 'title', |
|
||||||
`show_type` tinyint(4) DEFAULT NULL COMMENT 'send email type,0:TABLE,1:TEXT', |
|
||||||
`content` text COMMENT 'Message content (can be email, can be SMS. Mail is stored in JSON map, and SMS is string)', |
|
||||||
`alert_type` tinyint(4) DEFAULT NULL COMMENT '0:email,1:sms', |
|
||||||
`alert_status` tinyint(4) DEFAULT '0' COMMENT '0:wait running,1:success,2:failed', |
|
||||||
`log` text COMMENT 'log', |
|
||||||
`alertgroup_id` int(11) DEFAULT NULL COMMENT 'alert group id', |
|
||||||
`receivers` text COMMENT 'receivers', |
|
||||||
`receivers_cc` text COMMENT 'cc', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_alertgroup |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_alertgroup`; |
|
||||||
CREATE TABLE `t_escheduler_alertgroup` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`group_name` varchar(255) DEFAULT NULL COMMENT 'group name', |
|
||||||
`group_type` tinyint(4) DEFAULT NULL COMMENT 'Group type (message 0, SMS 1...)', |
|
||||||
`desc` varchar(255) DEFAULT NULL COMMENT 'description', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_command |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_command`; |
|
||||||
CREATE TABLE `t_escheduler_command` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`command_type` tinyint(4) DEFAULT NULL COMMENT 'Command type: 0 start workflow, 1 start execution from current node, 2 resume fault-tolerant workflow, 3 resume pause process, 4 start execution from failed node, 5 complement, 6 schedule, 7 rerun, 8 pause, 9 stop, 10 resume waiting thread', |
|
||||||
`process_definition_id` int(11) DEFAULT NULL COMMENT 'process definition id', |
|
||||||
`command_param` text COMMENT 'json command parameters', |
|
||||||
`task_depend_type` tinyint(4) DEFAULT NULL COMMENT 'Node dependency type: 0 current node, 1 forward, 2 backward', |
|
||||||
`failure_strategy` tinyint(4) DEFAULT '0' COMMENT 'Failed policy: 0 end, 1 continue', |
|
||||||
`warning_type` tinyint(4) DEFAULT '0' COMMENT 'Alarm type: 0 is not sent, 1 process is sent successfully, 2 process is sent failed, 3 process is sent successfully and all failures are sent', |
|
||||||
`warning_group_id` int(11) DEFAULT NULL COMMENT 'warning group', |
|
||||||
`schedule_time` datetime DEFAULT NULL COMMENT 'schedule time', |
|
||||||
`start_time` datetime DEFAULT NULL COMMENT 'start time', |
|
||||||
`executor_id` int(11) DEFAULT NULL COMMENT 'executor id', |
|
||||||
`dependence` varchar(255) DEFAULT NULL COMMENT 'dependence', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
`process_instance_priority` int(11) DEFAULT NULL COMMENT 'process instance priority: 0 Highest,1 High,2 Medium,3 Low,4 Lowest', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_datasource |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_datasource`; |
|
||||||
CREATE TABLE `t_escheduler_datasource` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`name` varchar(64) NOT NULL COMMENT 'data source name', |
|
||||||
`note` varchar(256) DEFAULT NULL COMMENT 'description', |
|
||||||
`type` tinyint(4) NOT NULL COMMENT 'data source type: 0:mysql,1:postgresql,2:hive,3:spark', |
|
||||||
`user_id` int(11) NOT NULL COMMENT 'the creator id', |
|
||||||
`connection_params` text NOT NULL COMMENT 'json connection params', |
|
||||||
`create_time` datetime NOT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_master_server |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_master_server`; |
|
||||||
CREATE TABLE `t_escheduler_master_server` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`host` varchar(45) DEFAULT NULL COMMENT 'ip', |
|
||||||
`port` int(11) DEFAULT NULL COMMENT 'port', |
|
||||||
`zk_directory` varchar(64) DEFAULT NULL COMMENT 'the server path in zk directory', |
|
||||||
`res_info` varchar(255) DEFAULT NULL COMMENT 'json resource information:{"cpu":xxx,"memory":xxx}', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`last_heartbeat_time` datetime DEFAULT NULL COMMENT 'last heart beat time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_process_definition |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_process_definition`; |
|
||||||
CREATE TABLE `t_escheduler_process_definition` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`name` varchar(255) DEFAULT NULL COMMENT 'process definition name', |
|
||||||
`version` int(11) DEFAULT NULL COMMENT 'process definition version', |
|
||||||
`release_state` tinyint(4) DEFAULT NULL COMMENT 'process definition release state:0:offline,1:online', |
|
||||||
`project_id` int(11) DEFAULT NULL COMMENT 'project id', |
|
||||||
`user_id` int(11) DEFAULT NULL COMMENT 'process definition creator id', |
|
||||||
`process_definition_json` longtext COMMENT 'process definition json content', |
|
||||||
`desc` text COMMENT 'process definition description', |
|
||||||
`global_params` text COMMENT 'global parameters', |
|
||||||
`flag` tinyint(4) DEFAULT NULL COMMENT '0 not available, 1 available', |
|
||||||
`locations` text COMMENT 'Node location information', |
|
||||||
`connects` text COMMENT 'Node connection information', |
|
||||||
`receivers` text COMMENT 'receivers', |
|
||||||
`receivers_cc` text COMMENT 'cc', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
KEY `process_definition_index` (`project_id`,`id`) USING BTREE |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_process_instance |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_process_instance`; |
|
||||||
CREATE TABLE `t_escheduler_process_instance` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`name` varchar(255) DEFAULT NULL COMMENT 'process instance name', |
|
||||||
`process_definition_id` int(11) DEFAULT NULL COMMENT 'process definition id', |
|
||||||
`state` tinyint(4) DEFAULT NULL COMMENT 'process instance Status: 0 commit succeeded, 1 running, 2 prepare to pause, 3 pause, 4 prepare to stop, 5 stop, 6 fail, 7 succeed, 8 need fault tolerance, 9 kill, 10 wait for thread, 11 wait for dependency to complete', |
|
||||||
`recovery` tinyint(4) DEFAULT NULL COMMENT 'process instance failover flag:0:normal,1:failover instance', |
|
||||||
`start_time` datetime DEFAULT NULL COMMENT 'process instance start time', |
|
||||||
`end_time` datetime DEFAULT NULL COMMENT 'process instance end time', |
|
||||||
`run_times` int(11) DEFAULT NULL COMMENT 'process instance run times', |
|
||||||
`host` varchar(45) DEFAULT NULL COMMENT 'process instance host', |
|
||||||
`command_type` tinyint(4) DEFAULT NULL COMMENT 'command type', |
|
||||||
`command_param` text COMMENT 'json command parameters', |
|
||||||
`task_depend_type` tinyint(4) DEFAULT NULL COMMENT 'task depend type. 0: only current node,1:before the node,2:later nodes', |
|
||||||
`max_try_times` tinyint(4) DEFAULT '0' COMMENT 'max try times', |
|
||||||
`failure_strategy` tinyint(4) DEFAULT '0' COMMENT 'failure strategy. 0:end the process when node failed,1:continue running the other nodes when node failed', |
|
||||||
`warning_type` tinyint(4) DEFAULT '0' COMMENT 'warning type. 0:no warning,1:warning if process success,2:warning if process failed,3:warning if success', |
|
||||||
`warning_group_id` int(11) DEFAULT NULL COMMENT 'warning group id', |
|
||||||
`schedule_time` datetime DEFAULT NULL COMMENT 'schedule time', |
|
||||||
`command_start_time` datetime DEFAULT NULL COMMENT 'command start time', |
|
||||||
`global_params` text COMMENT 'global parameters', |
|
||||||
`process_instance_json` longtext COMMENT 'process instance json(copy的process definition 的json)', |
|
||||||
`flag` tinyint(4) DEFAULT '1' COMMENT 'flag', |
|
||||||
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
|
||||||
`is_sub_process` int(11) DEFAULT '0' COMMENT 'flag, whether the process is sub process', |
|
||||||
`executor_id` int(11) NOT NULL COMMENT 'executor id', |
|
||||||
`locations` text COMMENT 'Node location information', |
|
||||||
`connects` text COMMENT 'Node connection information', |
|
||||||
`history_cmd` text COMMENT 'history commands of process instance operation', |
|
||||||
`dependence_schedule_times` text COMMENT 'depend schedule fire time', |
|
||||||
`process_instance_priority` int(11) DEFAULT NULL COMMENT 'process instance priority. 0 Highest,1 High,2 Medium,3 Low,4 Lowest', |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
KEY `process_instance_index` (`process_definition_id`,`id`) USING BTREE, |
|
||||||
KEY `start_time_index` (`start_time`) USING BTREE |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_project |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_project`; |
|
||||||
CREATE TABLE `t_escheduler_project` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`name` varchar(100) DEFAULT NULL COMMENT 'project name', |
|
||||||
`desc` varchar(200) DEFAULT NULL COMMENT 'project description', |
|
||||||
`user_id` int(11) DEFAULT NULL COMMENT 'creator id', |
|
||||||
`flag` tinyint(4) DEFAULT '1' COMMENT '0 not available, 1 available', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
KEY `user_id_index` (`user_id`) USING BTREE |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_queue |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_queue`; |
|
||||||
CREATE TABLE `t_escheduler_queue` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`queue_name` varchar(64) DEFAULT NULL COMMENT 'queue name', |
|
||||||
`queue` varchar(64) DEFAULT NULL COMMENT 'yarn queue name', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_relation_datasource_user |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_relation_datasource_user`; |
|
||||||
CREATE TABLE `t_escheduler_relation_datasource_user` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`user_id` int(11) NOT NULL COMMENT 'user id', |
|
||||||
`datasource_id` int(11) DEFAULT NULL COMMENT 'data source id', |
|
||||||
`perm` int(11) DEFAULT '1' COMMENT 'limits of authority', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_relation_process_instance |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_relation_process_instance`; |
|
||||||
CREATE TABLE `t_escheduler_relation_process_instance` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`parent_process_instance_id` int(11) DEFAULT NULL COMMENT 'parent process instance id', |
|
||||||
`parent_task_instance_id` int(11) DEFAULT NULL COMMENT 'parent process instance id', |
|
||||||
`process_instance_id` int(11) DEFAULT NULL COMMENT 'child process instance id', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_relation_project_user |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_relation_project_user`; |
|
||||||
CREATE TABLE `t_escheduler_relation_project_user` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`user_id` int(11) NOT NULL COMMENT 'user id', |
|
||||||
`project_id` int(11) DEFAULT NULL COMMENT 'project id', |
|
||||||
`perm` int(11) DEFAULT '1' COMMENT 'limits of authority', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
KEY `user_id_index` (`user_id`) USING BTREE |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_relation_resources_user |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_relation_resources_user`; |
|
||||||
CREATE TABLE `t_escheduler_relation_resources_user` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT, |
|
||||||
`user_id` int(11) NOT NULL COMMENT 'user id', |
|
||||||
`resources_id` int(11) DEFAULT NULL COMMENT 'resource id', |
|
||||||
`perm` int(11) DEFAULT '1' COMMENT 'limits of authority', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_relation_udfs_user |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_relation_udfs_user`; |
|
||||||
CREATE TABLE `t_escheduler_relation_udfs_user` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`user_id` int(11) NOT NULL COMMENT 'userid', |
|
||||||
`udf_id` int(11) DEFAULT NULL COMMENT 'udf id', |
|
||||||
`perm` int(11) DEFAULT '1' COMMENT 'limits of authority', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_relation_user_alertgroup |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_relation_user_alertgroup`; |
|
||||||
CREATE TABLE `t_escheduler_relation_user_alertgroup` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`alertgroup_id` int(11) DEFAULT NULL COMMENT 'alert group id', |
|
||||||
`user_id` int(11) DEFAULT NULL COMMENT 'user id', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_resources |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_resources`; |
|
||||||
CREATE TABLE `t_escheduler_resources` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`alias` varchar(64) DEFAULT NULL COMMENT 'alias', |
|
||||||
`file_name` varchar(64) DEFAULT NULL COMMENT 'file name', |
|
||||||
`desc` varchar(256) DEFAULT NULL COMMENT 'description', |
|
||||||
`user_id` int(11) DEFAULT NULL COMMENT 'user id', |
|
||||||
`type` tinyint(4) DEFAULT NULL COMMENT 'resource type,0:FILE,1:UDF', |
|
||||||
`size` bigint(20) DEFAULT NULL COMMENT 'resource size', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_schedules |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_schedules`; |
|
||||||
CREATE TABLE `t_escheduler_schedules` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`process_definition_id` int(11) NOT NULL COMMENT 'process definition id', |
|
||||||
`start_time` datetime NOT NULL COMMENT 'start time', |
|
||||||
`end_time` datetime NOT NULL COMMENT 'end time', |
|
||||||
`crontab` varchar(256) NOT NULL COMMENT 'crontab description', |
|
||||||
`failure_strategy` tinyint(4) NOT NULL COMMENT 'failure strategy. 0:end,1:continue', |
|
||||||
`user_id` int(11) NOT NULL COMMENT 'user id', |
|
||||||
`release_state` tinyint(4) NOT NULL COMMENT 'release state. 0:offline,1:online ', |
|
||||||
`warning_type` tinyint(4) NOT NULL COMMENT 'Alarm type: 0 is not sent, 1 process is sent successfully, 2 process is sent failed, 3 process is sent successfully and all failures are sent', |
|
||||||
`warning_group_id` int(11) DEFAULT NULL COMMENT 'alert group id', |
|
||||||
`process_instance_priority` int(11) DEFAULT NULL COMMENT 'process instance priority:0 Highest,1 High,2 Medium,3 Low,4 Lowest', |
|
||||||
`create_time` datetime NOT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime NOT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_session |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_session`; |
|
||||||
CREATE TABLE `t_escheduler_session` ( |
|
||||||
`id` varchar(64) NOT NULL COMMENT 'key', |
|
||||||
`user_id` int(11) DEFAULT NULL COMMENT 'user id', |
|
||||||
`ip` varchar(45) DEFAULT NULL COMMENT 'ip', |
|
||||||
`last_login_time` datetime DEFAULT NULL COMMENT 'last login time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_task_instance |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_task_instance`; |
|
||||||
CREATE TABLE `t_escheduler_task_instance` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`name` varchar(255) DEFAULT NULL COMMENT 'task name', |
|
||||||
`task_type` varchar(64) DEFAULT NULL COMMENT 'task type', |
|
||||||
`process_definition_id` int(11) DEFAULT NULL COMMENT 'process definition id', |
|
||||||
`process_instance_id` int(11) DEFAULT NULL COMMENT 'process instance id', |
|
||||||
`task_json` longtext COMMENT 'task content json', |
|
||||||
`state` tinyint(4) DEFAULT NULL COMMENT 'Status: 0 commit succeeded, 1 running, 2 prepare to pause, 3 pause, 4 prepare to stop, 5 stop, 6 fail, 7 succeed, 8 need fault tolerance, 9 kill, 10 wait for thread, 11 wait for dependency to complete', |
|
||||||
`submit_time` datetime DEFAULT NULL COMMENT 'task submit time', |
|
||||||
`start_time` datetime DEFAULT NULL COMMENT 'task start time', |
|
||||||
`end_time` datetime DEFAULT NULL COMMENT 'task end time', |
|
||||||
`host` varchar(45) DEFAULT NULL COMMENT 'host of task running on', |
|
||||||
`execute_path` varchar(200) DEFAULT NULL COMMENT 'task execute path in the host', |
|
||||||
`log_path` varchar(200) DEFAULT NULL COMMENT 'task log path', |
|
||||||
`alert_flag` tinyint(4) DEFAULT NULL COMMENT 'whether alert', |
|
||||||
`retry_times` int(4) DEFAULT '0' COMMENT 'task retry times', |
|
||||||
`pid` int(4) DEFAULT NULL COMMENT 'pid of task', |
|
||||||
`app_link` varchar(255) DEFAULT NULL COMMENT 'yarn app id', |
|
||||||
`flag` tinyint(4) DEFAULT '1' COMMENT '0 not available, 1 available', |
|
||||||
`retry_interval` int(4) DEFAULT NULL COMMENT 'retry interval when task failed ', |
|
||||||
`max_retry_times` int(2) DEFAULT NULL COMMENT 'max retry times', |
|
||||||
`task_instance_priority` int(11) DEFAULT NULL COMMENT 'task instance priority:0 Highest,1 High,2 Medium,3 Low,4 Lowest', |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
KEY `process_instance_id` (`process_instance_id`) USING BTREE, |
|
||||||
KEY `task_instance_index` (`process_definition_id`,`process_instance_id`) USING BTREE, |
|
||||||
CONSTRAINT `foreign_key_instance_id` FOREIGN KEY (`process_instance_id`) REFERENCES `t_escheduler_process_instance` (`id`) ON DELETE CASCADE |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_tenant |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_tenant`; |
|
||||||
CREATE TABLE `t_escheduler_tenant` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`tenant_code` varchar(64) DEFAULT NULL COMMENT 'tenant code', |
|
||||||
`tenant_name` varchar(64) DEFAULT NULL COMMENT 'tenant name', |
|
||||||
`desc` varchar(256) DEFAULT NULL COMMENT 'description', |
|
||||||
`queue_id` int(11) DEFAULT NULL COMMENT 'queue id', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_udfs |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_udfs`; |
|
||||||
CREATE TABLE `t_escheduler_udfs` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`user_id` int(11) NOT NULL COMMENT 'user id', |
|
||||||
`func_name` varchar(100) NOT NULL COMMENT 'UDF function name', |
|
||||||
`class_name` varchar(255) NOT NULL COMMENT 'class of udf', |
|
||||||
`type` tinyint(4) NOT NULL COMMENT 'Udf function type', |
|
||||||
`arg_types` varchar(255) DEFAULT NULL COMMENT 'arguments types', |
|
||||||
`database` varchar(255) DEFAULT NULL COMMENT 'data base', |
|
||||||
`desc` varchar(255) DEFAULT NULL COMMENT 'description', |
|
||||||
`resource_id` int(11) NOT NULL COMMENT 'resource id', |
|
||||||
`resource_name` varchar(255) NOT NULL COMMENT 'resource name', |
|
||||||
`create_time` datetime NOT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime NOT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_user |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_user`; |
|
||||||
CREATE TABLE `t_escheduler_user` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'user id', |
|
||||||
`user_name` varchar(64) DEFAULT NULL COMMENT 'user name', |
|
||||||
`user_password` varchar(64) DEFAULT NULL COMMENT 'user password', |
|
||||||
`user_type` tinyint(4) DEFAULT NULL COMMENT 'user type, 0:administrator,1:ordinary user', |
|
||||||
`email` varchar(64) DEFAULT NULL COMMENT 'email', |
|
||||||
`phone` varchar(11) DEFAULT NULL COMMENT 'phone', |
|
||||||
`tenant_id` int(11) DEFAULT NULL COMMENT 'tenant id', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
UNIQUE KEY `user_name_unique` (`user_name`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_escheduler_worker_server |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_escheduler_worker_server`; |
|
||||||
CREATE TABLE `t_escheduler_worker_server` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`host` varchar(45) DEFAULT NULL COMMENT 'ip', |
|
||||||
`port` int(11) DEFAULT NULL COMMENT 'process id', |
|
||||||
`zk_directory` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT 'zk path', |
|
||||||
`res_info` varchar(255) DEFAULT NULL COMMENT 'json resource info,{"cpu":xxx,"memroy":xxx}', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`last_heartbeat_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
/*drop table first */ |
|
||||||
DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE; |
|
||||||
DROP TABLE IF EXISTS QRTZ_LOCKS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_JOB_DETAILS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_CALENDARS; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_JOB_DETAILS( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
JOB_NAME VARCHAR(200) NOT NULL, |
|
||||||
JOB_GROUP VARCHAR(200) NOT NULL, |
|
||||||
DESCRIPTION VARCHAR(250) NULL, |
|
||||||
JOB_CLASS_NAME VARCHAR(250) NOT NULL, |
|
||||||
IS_DURABLE VARCHAR(1) NOT NULL, |
|
||||||
IS_NONCONCURRENT VARCHAR(1) NOT NULL, |
|
||||||
IS_UPDATE_DATA VARCHAR(1) NOT NULL, |
|
||||||
REQUESTS_RECOVERY VARCHAR(1) NOT NULL, |
|
||||||
JOB_DATA BLOB NULL, |
|
||||||
PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_TRIGGERS ( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
||||||
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
||||||
JOB_NAME VARCHAR(200) NOT NULL, |
|
||||||
JOB_GROUP VARCHAR(200) NOT NULL, |
|
||||||
DESCRIPTION VARCHAR(250) NULL, |
|
||||||
NEXT_FIRE_TIME BIGINT(13) NULL, |
|
||||||
PREV_FIRE_TIME BIGINT(13) NULL, |
|
||||||
PRIORITY INTEGER NULL, |
|
||||||
TRIGGER_STATE VARCHAR(16) NOT NULL, |
|
||||||
TRIGGER_TYPE VARCHAR(8) NOT NULL, |
|
||||||
START_TIME BIGINT(13) NOT NULL, |
|
||||||
END_TIME BIGINT(13) NULL, |
|
||||||
CALENDAR_NAME VARCHAR(200) NULL, |
|
||||||
MISFIRE_INSTR SMALLINT(2) NULL, |
|
||||||
JOB_DATA BLOB NULL, |
|
||||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), |
|
||||||
FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP) |
|
||||||
REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_SIMPLE_TRIGGERS ( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
||||||
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
||||||
REPEAT_COUNT BIGINT(7) NOT NULL, |
|
||||||
REPEAT_INTERVAL BIGINT(12) NOT NULL, |
|
||||||
TIMES_TRIGGERED BIGINT(10) NOT NULL, |
|
||||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), |
|
||||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) |
|
||||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_CRON_TRIGGERS ( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
||||||
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
||||||
CRON_EXPRESSION VARCHAR(120) NOT NULL, |
|
||||||
TIME_ZONE_ID VARCHAR(80), |
|
||||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), |
|
||||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) |
|
||||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_SIMPROP_TRIGGERS |
|
||||||
( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
||||||
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
||||||
STR_PROP_1 VARCHAR(512) NULL, |
|
||||||
STR_PROP_2 VARCHAR(512) NULL, |
|
||||||
STR_PROP_3 VARCHAR(512) NULL, |
|
||||||
INT_PROP_1 INT NULL, |
|
||||||
INT_PROP_2 INT NULL, |
|
||||||
LONG_PROP_1 BIGINT NULL, |
|
||||||
LONG_PROP_2 BIGINT NULL, |
|
||||||
DEC_PROP_1 NUMERIC(13,4) NULL, |
|
||||||
DEC_PROP_2 NUMERIC(13,4) NULL, |
|
||||||
BOOL_PROP_1 VARCHAR(1) NULL, |
|
||||||
BOOL_PROP_2 VARCHAR(1) NULL, |
|
||||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), |
|
||||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) |
|
||||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_BLOB_TRIGGERS ( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
||||||
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
||||||
BLOB_DATA BLOB NULL, |
|
||||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), |
|
||||||
INDEX (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP), |
|
||||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) |
|
||||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_CALENDARS ( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
CALENDAR_NAME VARCHAR(200) NOT NULL, |
|
||||||
CALENDAR BLOB NOT NULL, |
|
||||||
PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS ( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
||||||
PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_FIRED_TRIGGERS ( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
ENTRY_ID VARCHAR(95) NOT NULL, |
|
||||||
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
||||||
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
||||||
INSTANCE_NAME VARCHAR(200) NOT NULL, |
|
||||||
FIRED_TIME BIGINT(13) NOT NULL, |
|
||||||
SCHED_TIME BIGINT(13) NOT NULL, |
|
||||||
PRIORITY INTEGER NOT NULL, |
|
||||||
STATE VARCHAR(16) NOT NULL, |
|
||||||
JOB_NAME VARCHAR(200) NULL, |
|
||||||
JOB_GROUP VARCHAR(200) NULL, |
|
||||||
IS_NONCONCURRENT VARCHAR(1) NULL, |
|
||||||
REQUESTS_RECOVERY VARCHAR(1) NULL, |
|
||||||
PRIMARY KEY (SCHED_NAME,ENTRY_ID)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_SCHEDULER_STATE ( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
INSTANCE_NAME VARCHAR(200) NOT NULL, |
|
||||||
LAST_CHECKIN_TIME BIGINT(13) NOT NULL, |
|
||||||
CHECKIN_INTERVAL BIGINT(13) NOT NULL, |
|
||||||
PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_LOCKS ( |
|
||||||
SCHED_NAME VARCHAR(120) NOT NULL, |
|
||||||
LOCK_NAME VARCHAR(40) NOT NULL, |
|
||||||
PRIMARY KEY (SCHED_NAME,LOCK_NAME)) |
|
||||||
ENGINE=InnoDB; |
|
||||||
|
|
||||||
CREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS(SCHED_NAME,REQUESTS_RECOVERY); |
|
||||||
CREATE INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS(SCHED_NAME,JOB_GROUP); |
|
||||||
|
|
||||||
CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME,JOB_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME,CALENDAR_NAME); |
|
||||||
CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE); |
|
||||||
CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE); |
|
||||||
CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE); |
|
||||||
CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME); |
|
||||||
CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME); |
|
||||||
CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME); |
|
||||||
CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE); |
|
||||||
CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE); |
|
||||||
|
|
||||||
CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME); |
|
||||||
CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY); |
|
||||||
CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); |
|
||||||
|
|
||||||
commit; |
|
||||||
|
|
||||||
|
|
@ -1,24 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
-- Records of t_escheduler_user,user : admin , password : dolphinscheduler123 |
|
||||||
INSERT INTO `t_escheduler_user` VALUES ('1', 'admin', '7ad2410b2f4c074479a8937a28a22b8f', '0', 'xxx@qq.com', '', '0', '2018-03-27 15:48:50', '2018-10-24 17:40:22'); |
|
||||||
INSERT INTO `t_escheduler_alertgroup` VALUES (1, 'default admin warning group', '0', 'default admin warning group','2018-11-29 10:20:39', '2018-11-29 10:20:39'); |
|
||||||
INSERT INTO `t_escheduler_relation_user_alertgroup` VALUES ('1', '1', '1', '2018-11-29 10:22:33', '2018-11-29 10:22:33'); |
|
||||||
|
|
||||||
-- Records of t_escheduler_queue,default queue name : default |
|
||||||
INSERT INTO `t_escheduler_queue` VALUES ('1', 'default', 'default'); |
|
@ -1,758 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE; |
|
||||||
DROP TABLE IF EXISTS QRTZ_LOCKS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_TRIGGERS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_JOB_DETAILS; |
|
||||||
DROP TABLE IF EXISTS QRTZ_CALENDARS; |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_JOB_DETAILS( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
JOB_NAME character varying(200) NOT NULL, |
|
||||||
JOB_GROUP character varying(200) NOT NULL, |
|
||||||
DESCRIPTION character varying(250) NULL, |
|
||||||
JOB_CLASS_NAME character varying(250) NOT NULL, |
|
||||||
IS_DURABLE boolean NOT NULL, |
|
||||||
IS_NONCONCURRENT boolean NOT NULL, |
|
||||||
IS_UPDATE_DATA boolean NOT NULL, |
|
||||||
REQUESTS_RECOVERY boolean NOT NULL, |
|
||||||
JOB_DATA bytea NULL); |
|
||||||
alter table QRTZ_JOB_DETAILS add primary key(SCHED_NAME,JOB_NAME,JOB_GROUP); |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_TRIGGERS ( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
TRIGGER_NAME character varying(200) NOT NULL, |
|
||||||
TRIGGER_GROUP character varying(200) NOT NULL, |
|
||||||
JOB_NAME character varying(200) NOT NULL, |
|
||||||
JOB_GROUP character varying(200) NOT NULL, |
|
||||||
DESCRIPTION character varying(250) NULL, |
|
||||||
NEXT_FIRE_TIME BIGINT NULL, |
|
||||||
PREV_FIRE_TIME BIGINT NULL, |
|
||||||
PRIORITY INTEGER NULL, |
|
||||||
TRIGGER_STATE character varying(16) NOT NULL, |
|
||||||
TRIGGER_TYPE character varying(8) NOT NULL, |
|
||||||
START_TIME BIGINT NOT NULL, |
|
||||||
END_TIME BIGINT NULL, |
|
||||||
CALENDAR_NAME character varying(200) NULL, |
|
||||||
MISFIRE_INSTR SMALLINT NULL, |
|
||||||
JOB_DATA bytea NULL) ; |
|
||||||
alter table QRTZ_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_SIMPLE_TRIGGERS ( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
TRIGGER_NAME character varying(200) NOT NULL, |
|
||||||
TRIGGER_GROUP character varying(200) NOT NULL, |
|
||||||
REPEAT_COUNT BIGINT NOT NULL, |
|
||||||
REPEAT_INTERVAL BIGINT NOT NULL, |
|
||||||
TIMES_TRIGGERED BIGINT NOT NULL) ; |
|
||||||
alter table QRTZ_SIMPLE_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_CRON_TRIGGERS ( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
TRIGGER_NAME character varying(200) NOT NULL, |
|
||||||
TRIGGER_GROUP character varying(200) NOT NULL, |
|
||||||
CRON_EXPRESSION character varying(120) NOT NULL, |
|
||||||
TIME_ZONE_ID character varying(80)) ; |
|
||||||
alter table QRTZ_CRON_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_SIMPROP_TRIGGERS |
|
||||||
( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
TRIGGER_NAME character varying(200) NOT NULL, |
|
||||||
TRIGGER_GROUP character varying(200) NOT NULL, |
|
||||||
STR_PROP_1 character varying(512) NULL, |
|
||||||
STR_PROP_2 character varying(512) NULL, |
|
||||||
STR_PROP_3 character varying(512) NULL, |
|
||||||
INT_PROP_1 INT NULL, |
|
||||||
INT_PROP_2 INT NULL, |
|
||||||
LONG_PROP_1 BIGINT NULL, |
|
||||||
LONG_PROP_2 BIGINT NULL, |
|
||||||
DEC_PROP_1 NUMERIC(13,4) NULL, |
|
||||||
DEC_PROP_2 NUMERIC(13,4) NULL, |
|
||||||
BOOL_PROP_1 boolean NULL, |
|
||||||
BOOL_PROP_2 boolean NULL) ; |
|
||||||
alter table QRTZ_SIMPROP_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_BLOB_TRIGGERS ( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
TRIGGER_NAME character varying(200) NOT NULL, |
|
||||||
TRIGGER_GROUP character varying(200) NOT NULL, |
|
||||||
BLOB_DATA bytea NULL) ; |
|
||||||
alter table QRTZ_BLOB_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_CALENDARS ( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
CALENDAR_NAME character varying(200) NOT NULL, |
|
||||||
CALENDAR bytea NOT NULL) ; |
|
||||||
alter table QRTZ_CALENDARS add primary key(SCHED_NAME,CALENDAR_NAME); |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS ( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
TRIGGER_GROUP character varying(200) NOT NULL) ; |
|
||||||
alter table QRTZ_PAUSED_TRIGGER_GRPS add primary key(SCHED_NAME,TRIGGER_GROUP); |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_FIRED_TRIGGERS ( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
ENTRY_ID character varying(95) NOT NULL, |
|
||||||
TRIGGER_NAME character varying(200) NOT NULL, |
|
||||||
TRIGGER_GROUP character varying(200) NOT NULL, |
|
||||||
INSTANCE_NAME character varying(200) NOT NULL, |
|
||||||
FIRED_TIME BIGINT NOT NULL, |
|
||||||
SCHED_TIME BIGINT NOT NULL, |
|
||||||
PRIORITY INTEGER NOT NULL, |
|
||||||
STATE character varying(16) NOT NULL, |
|
||||||
JOB_NAME character varying(200) NULL, |
|
||||||
JOB_GROUP character varying(200) NULL, |
|
||||||
IS_NONCONCURRENT boolean NULL, |
|
||||||
REQUESTS_RECOVERY boolean NULL) ; |
|
||||||
alter table QRTZ_FIRED_TRIGGERS add primary key(SCHED_NAME,ENTRY_ID); |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_SCHEDULER_STATE ( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
INSTANCE_NAME character varying(200) NOT NULL, |
|
||||||
LAST_CHECKIN_TIME BIGINT NOT NULL, |
|
||||||
CHECKIN_INTERVAL BIGINT NOT NULL) ; |
|
||||||
alter table QRTZ_SCHEDULER_STATE add primary key(SCHED_NAME,INSTANCE_NAME); |
|
||||||
|
|
||||||
CREATE TABLE QRTZ_LOCKS ( |
|
||||||
SCHED_NAME character varying(120) NOT NULL, |
|
||||||
LOCK_NAME character varying(40) NOT NULL) ; |
|
||||||
alter table QRTZ_LOCKS add primary key(SCHED_NAME,LOCK_NAME); |
|
||||||
|
|
||||||
CREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS(SCHED_NAME,REQUESTS_RECOVERY); |
|
||||||
CREATE INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS(SCHED_NAME,JOB_GROUP); |
|
||||||
|
|
||||||
CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME,JOB_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME,CALENDAR_NAME); |
|
||||||
CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE); |
|
||||||
CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE); |
|
||||||
CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE); |
|
||||||
CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME); |
|
||||||
CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME); |
|
||||||
CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME); |
|
||||||
CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE); |
|
||||||
CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE); |
|
||||||
|
|
||||||
CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME); |
|
||||||
CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY); |
|
||||||
CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); |
|
||||||
CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); |
|
||||||
|
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_access_token |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_access_token; |
|
||||||
CREATE TABLE t_ds_access_token ( |
|
||||||
id int NOT NULL , |
|
||||||
user_id int DEFAULT NULL , |
|
||||||
token varchar(64) DEFAULT NULL , |
|
||||||
expire_time timestamp DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_alert |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_alert; |
|
||||||
CREATE TABLE t_ds_alert ( |
|
||||||
id int NOT NULL , |
|
||||||
title varchar(64) DEFAULT NULL , |
|
||||||
show_type int DEFAULT NULL , |
|
||||||
content text , |
|
||||||
alert_type int DEFAULT NULL , |
|
||||||
alert_status int DEFAULT '0' , |
|
||||||
log text , |
|
||||||
alertgroup_id int DEFAULT NULL , |
|
||||||
receivers text , |
|
||||||
receivers_cc text , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_alertgroup |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_alertgroup; |
|
||||||
CREATE TABLE t_ds_alertgroup ( |
|
||||||
id int NOT NULL , |
|
||||||
group_name varchar(255) DEFAULT NULL , |
|
||||||
group_type int DEFAULT NULL , |
|
||||||
description varchar(255) DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_command |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_command; |
|
||||||
CREATE TABLE t_ds_command ( |
|
||||||
id int NOT NULL , |
|
||||||
command_type int DEFAULT NULL , |
|
||||||
process_definition_id int DEFAULT NULL , |
|
||||||
command_param text , |
|
||||||
task_depend_type int DEFAULT NULL , |
|
||||||
failure_strategy int DEFAULT '0' , |
|
||||||
warning_type int DEFAULT '0' , |
|
||||||
warning_group_id int DEFAULT NULL , |
|
||||||
schedule_time timestamp DEFAULT NULL , |
|
||||||
start_time timestamp DEFAULT NULL , |
|
||||||
executor_id int DEFAULT NULL , |
|
||||||
dependence varchar(255) DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
process_instance_priority int DEFAULT NULL , |
|
||||||
worker_group_id int DEFAULT '-1' , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_datasource |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_datasource; |
|
||||||
CREATE TABLE t_ds_datasource ( |
|
||||||
id int NOT NULL , |
|
||||||
name varchar(64) NOT NULL , |
|
||||||
note varchar(256) DEFAULT NULL , |
|
||||||
type int NOT NULL , |
|
||||||
user_id int NOT NULL , |
|
||||||
connection_params text NOT NULL , |
|
||||||
create_time timestamp NOT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_error_command |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_error_command; |
|
||||||
CREATE TABLE t_ds_error_command ( |
|
||||||
id int NOT NULL , |
|
||||||
command_type int DEFAULT NULL , |
|
||||||
executor_id int DEFAULT NULL , |
|
||||||
process_definition_id int DEFAULT NULL , |
|
||||||
command_param text , |
|
||||||
task_depend_type int DEFAULT NULL , |
|
||||||
failure_strategy int DEFAULT '0' , |
|
||||||
warning_type int DEFAULT '0' , |
|
||||||
warning_group_id int DEFAULT NULL , |
|
||||||
schedule_time timestamp DEFAULT NULL , |
|
||||||
start_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
dependence text , |
|
||||||
process_instance_priority int DEFAULT NULL , |
|
||||||
worker_group_id int DEFAULT '-1' , |
|
||||||
message text , |
|
||||||
PRIMARY KEY (id) |
|
||||||
); |
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_master_server |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_master_server; |
|
||||||
CREATE TABLE t_ds_master_server ( |
|
||||||
id int NOT NULL , |
|
||||||
host varchar(45) DEFAULT NULL , |
|
||||||
port int DEFAULT NULL , |
|
||||||
zk_directory varchar(64) DEFAULT NULL , |
|
||||||
res_info varchar(256) DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
last_heartbeat_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_process_definition |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_process_definition; |
|
||||||
CREATE TABLE t_ds_process_definition ( |
|
||||||
id int NOT NULL , |
|
||||||
name varchar(255) DEFAULT NULL , |
|
||||||
version int DEFAULT NULL , |
|
||||||
release_state int DEFAULT NULL , |
|
||||||
project_id int DEFAULT NULL , |
|
||||||
user_id int DEFAULT NULL , |
|
||||||
process_definition_json text , |
|
||||||
description text , |
|
||||||
global_params text , |
|
||||||
flag int DEFAULT NULL , |
|
||||||
locations text , |
|
||||||
connects text , |
|
||||||
receivers text , |
|
||||||
receivers_cc text , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
timeout int DEFAULT '0' , |
|
||||||
tenant_id int NOT NULL DEFAULT '-1' , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
create index process_definition_index on t_ds_process_definition (project_id,id); |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_process_instance |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_process_instance; |
|
||||||
CREATE TABLE t_ds_process_instance ( |
|
||||||
id int NOT NULL , |
|
||||||
name varchar(255) DEFAULT NULL , |
|
||||||
process_definition_id int DEFAULT NULL , |
|
||||||
state int DEFAULT NULL , |
|
||||||
recovery int DEFAULT NULL , |
|
||||||
start_time timestamp DEFAULT NULL , |
|
||||||
end_time timestamp DEFAULT NULL , |
|
||||||
run_times int DEFAULT NULL , |
|
||||||
host varchar(45) DEFAULT NULL , |
|
||||||
command_type int DEFAULT NULL , |
|
||||||
command_param text , |
|
||||||
task_depend_type int DEFAULT NULL , |
|
||||||
max_try_times int DEFAULT '0' , |
|
||||||
failure_strategy int DEFAULT '0' , |
|
||||||
warning_type int DEFAULT '0' , |
|
||||||
warning_group_id int DEFAULT NULL , |
|
||||||
schedule_time timestamp DEFAULT NULL , |
|
||||||
command_start_time timestamp DEFAULT NULL , |
|
||||||
global_params text , |
|
||||||
process_instance_json text , |
|
||||||
flag int DEFAULT '1' , |
|
||||||
update_time timestamp NULL , |
|
||||||
is_sub_process int DEFAULT '0' , |
|
||||||
executor_id int NOT NULL , |
|
||||||
locations text , |
|
||||||
connects text , |
|
||||||
history_cmd text , |
|
||||||
dependence_schedule_times text , |
|
||||||
process_instance_priority int DEFAULT NULL , |
|
||||||
worker_group_id int DEFAULT '-1' , |
|
||||||
timeout int DEFAULT '0' , |
|
||||||
tenant_id int NOT NULL DEFAULT '-1' , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
create index process_instance_index on t_ds_process_instance (process_definition_id,id); |
|
||||||
create index start_time_index on t_ds_process_instance (start_time); |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_project |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_project; |
|
||||||
CREATE TABLE t_ds_project ( |
|
||||||
id int NOT NULL , |
|
||||||
name varchar(100) DEFAULT NULL , |
|
||||||
code bigint NOT NULL, |
|
||||||
description varchar(200) DEFAULT NULL , |
|
||||||
user_id int DEFAULT NULL , |
|
||||||
flag int DEFAULT '1' , |
|
||||||
create_time timestamp DEFAULT CURRENT_TIMESTAMP , |
|
||||||
update_time timestamp DEFAULT CURRENT_TIMESTAMP , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
create index user_id_index on t_ds_project (user_id); |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_queue |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_queue; |
|
||||||
CREATE TABLE t_ds_queue ( |
|
||||||
id int NOT NULL , |
|
||||||
queue_name varchar(64) DEFAULT NULL , |
|
||||||
queue varchar(64) DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_relation_datasource_user |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_relation_datasource_user; |
|
||||||
CREATE TABLE t_ds_relation_datasource_user ( |
|
||||||
id int NOT NULL , |
|
||||||
user_id int NOT NULL , |
|
||||||
datasource_id int DEFAULT NULL , |
|
||||||
perm int DEFAULT '1' , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_relation_process_instance |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_relation_process_instance; |
|
||||||
CREATE TABLE t_ds_relation_process_instance ( |
|
||||||
id int NOT NULL , |
|
||||||
parent_process_instance_id int DEFAULT NULL , |
|
||||||
parent_task_instance_id int DEFAULT NULL , |
|
||||||
process_instance_id int DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_relation_project_user |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_relation_project_user; |
|
||||||
CREATE TABLE t_ds_relation_project_user ( |
|
||||||
id int NOT NULL , |
|
||||||
user_id int NOT NULL , |
|
||||||
project_id int DEFAULT NULL , |
|
||||||
perm int DEFAULT '1' , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
create index relation_project_user_id_index on t_ds_relation_project_user (user_id); |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_relation_resources_user |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_relation_resources_user; |
|
||||||
CREATE TABLE t_ds_relation_resources_user ( |
|
||||||
id int NOT NULL , |
|
||||||
user_id int NOT NULL , |
|
||||||
resources_id int DEFAULT NULL , |
|
||||||
perm int DEFAULT '1' , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_relation_udfs_user |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_relation_udfs_user; |
|
||||||
CREATE TABLE t_ds_relation_udfs_user ( |
|
||||||
id int NOT NULL , |
|
||||||
user_id int NOT NULL , |
|
||||||
udf_id int DEFAULT NULL , |
|
||||||
perm int DEFAULT '1' , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_relation_user_alertgroup |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_relation_user_alertgroup; |
|
||||||
CREATE TABLE t_ds_relation_user_alertgroup ( |
|
||||||
id int NOT NULL, |
|
||||||
alertgroup_id int DEFAULT NULL, |
|
||||||
user_id int DEFAULT NULL, |
|
||||||
create_time timestamp DEFAULT NULL, |
|
||||||
update_time timestamp DEFAULT NULL, |
|
||||||
PRIMARY KEY (id) |
|
||||||
); |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_resources |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_resources; |
|
||||||
CREATE TABLE t_ds_resources ( |
|
||||||
id int NOT NULL , |
|
||||||
alias varchar(64) DEFAULT NULL , |
|
||||||
file_name varchar(64) DEFAULT NULL , |
|
||||||
description varchar(256) DEFAULT NULL , |
|
||||||
user_id int DEFAULT NULL , |
|
||||||
type int DEFAULT NULL , |
|
||||||
size bigint DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_schedules |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_schedules; |
|
||||||
CREATE TABLE t_ds_schedules ( |
|
||||||
id int NOT NULL , |
|
||||||
process_definition_id int NOT NULL , |
|
||||||
start_time timestamp NOT NULL , |
|
||||||
end_time timestamp NOT NULL , |
|
||||||
crontab varchar(256) NOT NULL , |
|
||||||
failure_strategy int NOT NULL , |
|
||||||
user_id int NOT NULL , |
|
||||||
release_state int NOT NULL , |
|
||||||
warning_type int NOT NULL , |
|
||||||
warning_group_id int DEFAULT NULL , |
|
||||||
process_instance_priority int DEFAULT NULL , |
|
||||||
worker_group_id int DEFAULT '-1' , |
|
||||||
create_time timestamp NOT NULL , |
|
||||||
update_time timestamp NOT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
); |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_session |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_session; |
|
||||||
CREATE TABLE t_ds_session ( |
|
||||||
id varchar(64) NOT NULL , |
|
||||||
user_id int DEFAULT NULL , |
|
||||||
ip varchar(45) DEFAULT NULL , |
|
||||||
last_login_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
); |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_task_instance |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_task_instance; |
|
||||||
CREATE TABLE t_ds_task_instance ( |
|
||||||
id int NOT NULL , |
|
||||||
name varchar(255) DEFAULT NULL , |
|
||||||
task_type varchar(64) DEFAULT NULL , |
|
||||||
process_definition_id int DEFAULT NULL , |
|
||||||
process_instance_id int DEFAULT NULL , |
|
||||||
task_json text , |
|
||||||
state int DEFAULT NULL , |
|
||||||
submit_time timestamp DEFAULT NULL , |
|
||||||
start_time timestamp DEFAULT NULL , |
|
||||||
end_time timestamp DEFAULT NULL , |
|
||||||
host varchar(45) DEFAULT NULL , |
|
||||||
execute_path varchar(200) DEFAULT NULL , |
|
||||||
log_path varchar(200) DEFAULT NULL , |
|
||||||
alert_flag int DEFAULT NULL , |
|
||||||
retry_times int DEFAULT '0' , |
|
||||||
pid int DEFAULT NULL , |
|
||||||
app_link varchar(255) DEFAULT NULL , |
|
||||||
flag int DEFAULT '1' , |
|
||||||
retry_interval int DEFAULT NULL , |
|
||||||
max_retry_times int DEFAULT NULL , |
|
||||||
task_instance_priority int DEFAULT NULL , |
|
||||||
worker_group_id int DEFAULT '-1' , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_tenant |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_tenant; |
|
||||||
CREATE TABLE t_ds_tenant ( |
|
||||||
id int NOT NULL , |
|
||||||
tenant_code varchar(64) DEFAULT NULL , |
|
||||||
tenant_name varchar(64) DEFAULT NULL , |
|
||||||
description varchar(256) DEFAULT NULL , |
|
||||||
queue_id int DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_udfs |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_udfs; |
|
||||||
CREATE TABLE t_ds_udfs ( |
|
||||||
id int NOT NULL , |
|
||||||
user_id int NOT NULL , |
|
||||||
func_name varchar(100) NOT NULL , |
|
||||||
class_name varchar(255) NOT NULL , |
|
||||||
type int NOT NULL , |
|
||||||
arg_types varchar(255) DEFAULT NULL , |
|
||||||
database varchar(255) DEFAULT NULL , |
|
||||||
description varchar(255) DEFAULT NULL , |
|
||||||
resource_id int NOT NULL , |
|
||||||
resource_name varchar(255) NOT NULL , |
|
||||||
create_time timestamp NOT NULL , |
|
||||||
update_time timestamp NOT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_user |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_user; |
|
||||||
CREATE TABLE t_ds_user ( |
|
||||||
id int NOT NULL , |
|
||||||
user_name varchar(64) DEFAULT NULL , |
|
||||||
user_password varchar(64) DEFAULT NULL , |
|
||||||
user_type int DEFAULT NULL , |
|
||||||
email varchar(64) DEFAULT NULL , |
|
||||||
phone varchar(11) DEFAULT NULL , |
|
||||||
tenant_id int DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
queue varchar(64) DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
); |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_version |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_version; |
|
||||||
CREATE TABLE t_ds_version ( |
|
||||||
id int NOT NULL , |
|
||||||
version varchar(200) NOT NULL, |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
create index version_index on t_ds_version(version); |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_worker_group |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_worker_group; |
|
||||||
CREATE TABLE t_ds_worker_group ( |
|
||||||
id bigint NOT NULL , |
|
||||||
name varchar(256) DEFAULT NULL , |
|
||||||
ip_list varchar(256) DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
-- |
|
||||||
-- Table structure for table t_ds_worker_server |
|
||||||
-- |
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_ds_worker_server; |
|
||||||
CREATE TABLE t_ds_worker_server ( |
|
||||||
id int NOT NULL , |
|
||||||
host varchar(45) DEFAULT NULL , |
|
||||||
port int DEFAULT NULL , |
|
||||||
zk_directory varchar(64) DEFAULT NULL , |
|
||||||
res_info varchar(255) DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
last_heartbeat_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
) ; |
|
||||||
|
|
||||||
|
|
||||||
DROP SEQUENCE IF EXISTS t_ds_access_token_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_access_token_id_sequence; |
|
||||||
ALTER TABLE t_ds_access_token ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_access_token_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_alert_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_alert_id_sequence; |
|
||||||
ALTER TABLE t_ds_alert ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_alert_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_alertgroup_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_alertgroup_id_sequence; |
|
||||||
ALTER TABLE t_ds_alertgroup ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_alertgroup_id_sequence'); |
|
||||||
|
|
||||||
DROP SEQUENCE IF EXISTS t_ds_command_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_command_id_sequence; |
|
||||||
ALTER TABLE t_ds_command ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_command_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_datasource_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_datasource_id_sequence; |
|
||||||
ALTER TABLE t_ds_datasource ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_datasource_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_master_server_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_master_server_id_sequence; |
|
||||||
ALTER TABLE t_ds_master_server ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_master_server_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_process_definition_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_process_definition_id_sequence; |
|
||||||
ALTER TABLE t_ds_process_definition ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_definition_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_process_instance_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_process_instance_id_sequence; |
|
||||||
ALTER TABLE t_ds_process_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_instance_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_project_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_project_id_sequence; |
|
||||||
ALTER TABLE t_ds_project ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_project_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_queue_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_queue_id_sequence; |
|
||||||
ALTER TABLE t_ds_queue ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_queue_id_sequence'); |
|
||||||
|
|
||||||
DROP SEQUENCE IF EXISTS t_ds_relation_datasource_user_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_relation_datasource_user_id_sequence; |
|
||||||
ALTER TABLE t_ds_relation_datasource_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_datasource_user_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_relation_process_instance_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_relation_process_instance_id_sequence; |
|
||||||
ALTER TABLE t_ds_relation_process_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_process_instance_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_relation_project_user_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_relation_project_user_id_sequence; |
|
||||||
ALTER TABLE t_ds_relation_project_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_project_user_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_relation_resources_user_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_relation_resources_user_id_sequence; |
|
||||||
ALTER TABLE t_ds_relation_resources_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_resources_user_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_relation_udfs_user_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_relation_udfs_user_id_sequence; |
|
||||||
ALTER TABLE t_ds_relation_udfs_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_udfs_user_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_relation_user_alertgroup_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_relation_user_alertgroup_id_sequence; |
|
||||||
ALTER TABLE t_ds_relation_user_alertgroup ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_user_alertgroup_id_sequence'); |
|
||||||
|
|
||||||
DROP SEQUENCE IF EXISTS t_ds_resources_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_resources_id_sequence; |
|
||||||
ALTER TABLE t_ds_resources ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_resources_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_schedules_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_schedules_id_sequence; |
|
||||||
ALTER TABLE t_ds_schedules ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_schedules_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_task_instance_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_task_instance_id_sequence; |
|
||||||
ALTER TABLE t_ds_task_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_task_instance_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_tenant_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_tenant_id_sequence; |
|
||||||
ALTER TABLE t_ds_tenant ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_tenant_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_udfs_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_udfs_id_sequence; |
|
||||||
ALTER TABLE t_ds_udfs ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_udfs_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_user_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_user_id_sequence; |
|
||||||
ALTER TABLE t_ds_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_user_id_sequence'); |
|
||||||
|
|
||||||
DROP SEQUENCE IF EXISTS t_ds_version_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_version_id_sequence; |
|
||||||
ALTER TABLE t_ds_version ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_version_id_sequence'); |
|
||||||
|
|
||||||
DROP SEQUENCE IF EXISTS t_ds_worker_group_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_worker_group_id_sequence; |
|
||||||
ALTER TABLE t_ds_worker_group ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_worker_group_id_sequence'); |
|
||||||
DROP SEQUENCE IF EXISTS t_ds_worker_server_id_sequence; |
|
||||||
CREATE SEQUENCE t_ds_worker_server_id_sequence; |
|
||||||
ALTER TABLE t_ds_worker_server ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_worker_server_id_sequence'); |
|
@ -1,31 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
-- Records of t_ds_user,user : admin , password : dolphinscheduler123 |
|
||||||
INSERT INTO t_ds_user(user_name,user_password,user_type,email,phone,tenant_id,create_time,update_time) VALUES ('admin', '7ad2410b2f4c074479a8937a28a22b8f', '0', 'xxx@qq.com', '', '0', '2018-03-27 15:48:50', '2018-10-24 17:40:22'); |
|
||||||
|
|
||||||
-- Records of t_ds_alertgroup,dolphinscheduler warning group |
|
||||||
INSERT INTO t_ds_alertgroup(group_name,group_type,description,create_time,update_time) VALUES ('dolphinscheduler warning group', '0', 'dolphinscheduler warning group','2018-11-29 10:20:39', '2018-11-29 10:20:39'); |
|
||||||
INSERT INTO t_ds_relation_user_alertgroup(alertgroup_id,user_id,create_time,update_time) VALUES ( '1', '1', '2018-11-29 10:22:33', '2018-11-29 10:22:33'); |
|
||||||
|
|
||||||
-- Records of t_ds_queue,default queue name : default |
|
||||||
INSERT INTO t_ds_queue(queue_name,queue,create_time,update_time) VALUES ('default', 'default','2018-11-29 10:22:33', '2018-11-29 10:22:33'); |
|
||||||
|
|
||||||
-- Records of t_ds_queue,default queue name : default |
|
||||||
INSERT INTO t_ds_version(version) VALUES ('1.2.0'); |
|
||||||
|
|
||||||
|
|
@ -1,58 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
-- ac_escheduler_T_t_escheduler_queue_C_create_time |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_queue_C_create_time; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_queue_C_create_time() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_queue' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='create_time') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_queue ADD COLUMN create_time datetime DEFAULT NULL COMMENT 'create time' AFTER queue; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_queue_C_create_time; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_queue_C_create_time; |
|
||||||
|
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_queue_C_update_time |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_queue_C_update_time; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_queue_C_update_time() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_queue' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='update_time') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_queue ADD COLUMN update_time datetime DEFAULT NULL COMMENT 'update time' AFTER create_time; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_queue_C_update_time; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_queue_C_update_time; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,262 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
-- ac_escheduler_T_t_escheduler_version |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_version; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_version() |
|
||||||
BEGIN |
|
||||||
drop table if exists t_escheduler_version; |
|
||||||
CREATE TABLE IF NOT EXISTS `t_escheduler_version` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT, |
|
||||||
`version` varchar(200) NOT NULL, |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
UNIQUE KEY `version_UNIQUE` (`version`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='version'; |
|
||||||
|
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_version; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_version; |
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_user_C_queue |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_user_C_queue; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_user_C_queue() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_user' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='queue') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_user ADD COLUMN queue varchar(64) COMMENT 'queue' AFTER update_time; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_user_C_queue; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_user_C_queue; |
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_access_token |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_access_token; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_access_token() |
|
||||||
BEGIN |
|
||||||
drop table if exists t_escheduler_access_token; |
|
||||||
CREATE TABLE IF NOT EXISTS `t_escheduler_access_token` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', |
|
||||||
`user_id` int(11) DEFAULT NULL COMMENT 'user id', |
|
||||||
`token` varchar(64) DEFAULT NULL COMMENT 'token', |
|
||||||
`expire_time` datetime DEFAULT NULL COMMENT 'end time of token ', |
|
||||||
`create_time` datetime DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_access_token; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_access_token; |
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_error_command |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_error_command; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_error_command() |
|
||||||
BEGIN |
|
||||||
drop table if exists t_escheduler_error_command; |
|
||||||
CREATE TABLE IF NOT EXISTS `t_escheduler_error_command` ( |
|
||||||
`id` int(11) NOT NULL COMMENT 'key', |
|
||||||
`command_type` tinyint(4) NULL DEFAULT NULL COMMENT 'command type', |
|
||||||
`executor_id` int(11) NULL DEFAULT NULL COMMENT 'executor id', |
|
||||||
`process_definition_id` int(11) NULL DEFAULT NULL COMMENT 'process definition id', |
|
||||||
`command_param` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'json command parameters', |
|
||||||
`task_depend_type` tinyint(4) NULL DEFAULT NULL COMMENT 'task depend type', |
|
||||||
`failure_strategy` tinyint(4) NULL DEFAULT 0 COMMENT 'failure strategy', |
|
||||||
`warning_type` tinyint(4) NULL DEFAULT 0 COMMENT 'warning type', |
|
||||||
`warning_group_id` int(11) NULL DEFAULT NULL COMMENT 'warning group id', |
|
||||||
`schedule_time` datetime NULL DEFAULT NULL COMMENT 'scheduler time', |
|
||||||
`start_time` datetime NULL DEFAULT NULL COMMENT 'start time', |
|
||||||
`update_time` datetime NULL DEFAULT NULL COMMENT 'update time', |
|
||||||
`dependence` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'dependence', |
|
||||||
`process_instance_priority` int(11) NULL DEFAULT NULL COMMENT 'process instance priority, 0 Highest,1 High,2 Medium,3 Low,4 Lowest', |
|
||||||
`worker_group_id` int(11) NULL DEFAULT -1 COMMENT 'worker group id', |
|
||||||
`message` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'message', |
|
||||||
PRIMARY KEY (`id`) USING BTREE |
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT=1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; |
|
||||||
|
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_error_command; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_error_command; |
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_worker_group |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_worker_group; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_worker_group() |
|
||||||
BEGIN |
|
||||||
drop table if exists t_escheduler_worker_group; |
|
||||||
CREATE TABLE IF NOT EXISTS `t_escheduler_worker_group` ( |
|
||||||
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'id', |
|
||||||
`name` varchar(256) NULL DEFAULT NULL COMMENT 'worker group name', |
|
||||||
`ip_list` varchar(256) NULL DEFAULT NULL COMMENT 'worker ip list. split by [,] ', |
|
||||||
`create_time` datetime NULL DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime NULL DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) USING BTREE |
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT=1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; |
|
||||||
|
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_worker_group; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_worker_group; |
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_task_instance_C_worker_group_id |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_task_instance_C_worker_group_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_task_instance_C_worker_group_id() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_task_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_task_instance ADD COLUMN `worker_group_id` int(11) NULL DEFAULT -1 COMMENT 'worker group id' AFTER `task_instance_priority`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_task_instance_C_worker_group_id; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_task_instance_C_worker_group_id; |
|
||||||
|
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_command_C_worker_group_id |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_command_C_worker_group_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_command_C_worker_group_id() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_command' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_command ADD COLUMN `worker_group_id` int(11) NULL DEFAULT -1 COMMENT 'worker group id' AFTER `process_instance_priority`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_command_C_worker_group_id; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_command_C_worker_group_id; |
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_schedules_C_worker_group_id |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_schedules_C_worker_group_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_schedules_C_worker_group_id() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_schedules' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_schedules ADD COLUMN `worker_group_id` int(11) NULL DEFAULT -1 COMMENT 'worker group id' AFTER `process_instance_priority`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_schedules_C_worker_group_id; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_schedules_C_worker_group_id; |
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_process_instance_C_worker_group_id |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_process_instance_C_worker_group_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_process_instance_C_worker_group_id() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_process_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_process_instance ADD COLUMN `worker_group_id` int(11) NULL DEFAULT -1 COMMENT 'worker group id' AFTER `process_instance_priority`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_process_instance_C_worker_group_id; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_process_instance_C_worker_group_id; |
|
||||||
|
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_process_instance_C_timeout |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_process_instance_C_timeout; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_process_instance_C_timeout() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_process_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='timeout') |
|
||||||
THEN |
|
||||||
ALTER TABLE `t_escheduler_process_instance` ADD COLUMN `timeout` int(11) NULL DEFAULT 0 COMMENT 'time out' AFTER `worker_group_id`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_process_instance_C_timeout; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_process_instance_C_timeout; |
|
||||||
|
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_process_definition_C_timeout |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_process_definition_C_timeout; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_process_definition_C_timeout() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_process_definition' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='timeout') |
|
||||||
THEN |
|
||||||
ALTER TABLE `t_escheduler_process_definition` ADD COLUMN `timeout` int(11) NULL DEFAULT 0 COMMENT 'time out' AFTER `create_time`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_process_definition_C_timeout; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_process_definition_C_timeout; |
|
@ -1,18 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
INSERT INTO `t_escheduler_version` (`version`) VALUES ('1.0.2'); |
|
@ -1,58 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_process_definition_C_tenant_id |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_process_definition_C_tenant_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_process_definition_C_tenant_id() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_process_definition' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='tenant_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE `t_escheduler_process_definition` ADD COLUMN `tenant_id` int(11) NOT NULL DEFAULT -1 COMMENT 'tenant id' AFTER `timeout`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_process_definition_C_tenant_id; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_process_definition_C_tenant_id; |
|
||||||
|
|
||||||
-- ac_escheduler_T_t_escheduler_process_instance_C_tenant_id |
|
||||||
drop PROCEDURE if EXISTS ac_escheduler_T_t_escheduler_process_instance_C_tenant_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_escheduler_T_t_escheduler_process_instance_C_tenant_id() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_escheduler_process_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='tenant_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE `t_escheduler_process_instance` ADD COLUMN `tenant_id` int(11) NOT NULL DEFAULT -1 COMMENT 'tenant id' AFTER `timeout`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_escheduler_T_t_escheduler_process_instance_C_tenant_id; |
|
||||||
DROP PROCEDURE ac_escheduler_T_t_escheduler_process_instance_C_tenant_id; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,623 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
-- ut_dolphin_T_t_ds_access_token |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_access_token; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_access_token() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_access_token' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_access_token RENAME t_ds_access_token; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_access_token; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_access_token; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_alert |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_alert; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_alert() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_alert' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_alert RENAME t_ds_alert; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_alert; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_alert; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_alertgroup |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_alertgroup; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_alertgroup() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_alertgroup' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_alertgroup RENAME t_ds_alertgroup; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_alertgroup; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_alertgroup; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_command |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_command; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_command() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_command' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_command RENAME t_ds_command; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_command; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_command; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_datasource |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_datasource; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_datasource() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_datasource' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_datasource RENAME t_ds_datasource; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_datasource; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_datasource; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_error_command |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_error_command; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_error_command() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_error_command' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_error_command RENAME t_ds_error_command; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_error_command; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_error_command; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_master_server |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_master_server; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_master_server() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_master_server' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_master_server RENAME t_ds_master_server; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_master_server; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_master_server; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_process_definition |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_process_definition; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_process_definition() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_process_definition' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_process_definition RENAME t_ds_process_definition; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_process_definition; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_process_definition; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_process_instance |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_process_instance; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_process_instance() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_process_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_process_instance RENAME t_ds_process_instance; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_process_instance; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_process_instance; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_project |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_project; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_project() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_project' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_project RENAME t_ds_project; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_project; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_project; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_queue |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_queue; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_queue() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_queue' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_queue RENAME t_ds_queue; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_queue; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_queue; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_relation_datasource_user |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_relation_datasource_user; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_relation_datasource_user() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_relation_datasource_user' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_relation_datasource_user RENAME t_ds_relation_datasource_user; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_relation_datasource_user; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_relation_datasource_user; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_relation_process_instance |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_relation_process_instance; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_relation_process_instance() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_relation_process_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_relation_process_instance RENAME t_ds_relation_process_instance; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_relation_process_instance; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_relation_process_instance; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_relation_project_user |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_relation_project_user; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_relation_project_user() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_relation_project_user' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_relation_project_user RENAME t_ds_relation_project_user; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_relation_project_user; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_relation_project_user; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_relation_resources_user |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_relation_resources_user; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_relation_resources_user() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_relation_resources_user' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_relation_resources_user RENAME t_ds_relation_resources_user; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_relation_resources_user; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_relation_resources_user; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_relation_udfs_user |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_relation_udfs_user; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_relation_udfs_user() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_relation_udfs_user' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_relation_udfs_user RENAME t_ds_relation_udfs_user; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_relation_udfs_user; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_relation_udfs_user; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_relation_user_alertgroup |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_relation_user_alertgroup; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_relation_user_alertgroup() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_relation_user_alertgroup' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_relation_user_alertgroup RENAME t_ds_relation_user_alertgroup; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_relation_user_alertgroup; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_relation_user_alertgroup; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_resources |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_resources; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_resources() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_resources' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_resources RENAME t_ds_resources; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_resources; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_resources; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_schedules |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_schedules; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_schedules() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_schedules' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_schedules RENAME t_ds_schedules; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_schedules; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_schedules; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_session |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_session; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_session() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_session' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_session RENAME t_ds_session; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_session; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_session; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_task_instance |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_task_instance; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_task_instance() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_task_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_task_instance RENAME t_ds_task_instance; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_task_instance; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_task_instance; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_tenant |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_tenant; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_tenant() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_tenant' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_tenant RENAME t_ds_tenant; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_tenant; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_tenant; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_udfs |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_udfs; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_udfs() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_udfs' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_udfs RENAME t_ds_udfs; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_udfs; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_udfs; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_user |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_user; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_user() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_user' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_user RENAME t_ds_user; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_user; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_user; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_version |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_version; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_version() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_version' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_version RENAME t_ds_version; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_version; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_version; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_worker_group |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_worker_group; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_worker_group() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_worker_group' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_worker_group RENAME t_ds_worker_group; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_worker_group; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_worker_group; |
|
||||||
|
|
||||||
-- ut_dolphin_T_t_ds_worker_server |
|
||||||
drop PROCEDURE if EXISTS ut_dolphin_T_t_ds_worker_server; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ut_dolphin_T_t_ds_worker_server() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.TABLES |
|
||||||
WHERE TABLE_NAME='t_escheduler_worker_server' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE())) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_escheduler_worker_server RENAME t_ds_worker_server; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ut_dolphin_T_t_ds_worker_server; |
|
||||||
DROP PROCEDURE ut_dolphin_T_t_ds_worker_server; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_alertgroup_C_desc |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_alertgroup_C_desc; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_alertgroup_C_desc() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_alertgroup' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='desc') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_alertgroup CHANGE COLUMN `desc` description varchar(255); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_alertgroup_C_desc; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_alertgroup_C_desc; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_process_definition_C_desc |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_definition_C_desc; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_process_definition_C_desc() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_process_definition' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='desc') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_definition CHANGE COLUMN `desc` description text; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_process_definition_C_desc; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_process_definition_C_desc; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_project_C_desc |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_project_C_desc; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_project_C_desc() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_project' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='desc') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_project CHANGE COLUMN `desc` description varchar(200); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_project_C_desc; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_project_C_desc; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_resources_C_desc |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_resources_C_desc; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_resources_C_desc() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_resources' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='desc') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources CHANGE COLUMN `desc` description varchar(256); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_resources_C_desc; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_resources_C_desc; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_tenant_C_desc |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_tenant_C_desc; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_tenant_C_desc() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_tenant' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='desc') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_tenant CHANGE COLUMN `desc` description varchar(256); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_tenant_C_desc; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_tenant_C_desc; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_udfs_C_desc |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_udfs_C_desc; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_udfs_C_desc() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_udfs' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME='desc') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_udfs CHANGE COLUMN `desc` description varchar(255); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_udfs_C_desc; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_udfs_C_desc; |
|
@ -1,26 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
SET FOREIGN_KEY_CHECKS=0; |
|
||||||
UPDATE QRTZ_CRON_TRIGGERS SET SCHED_NAME='DolphinScheduler' WHERE SCHED_NAME='EasyScheduler'; |
|
||||||
UPDATE QRTZ_TRIGGERS SET SCHED_NAME='DolphinScheduler' WHERE SCHED_NAME='EasyScheduler'; |
|
||||||
UPDATE QRTZ_FIRED_TRIGGERS SET SCHED_NAME='DolphinScheduler' WHERE SCHED_NAME='EasyScheduler'; |
|
||||||
UPDATE QRTZ_JOB_DETAILS SET SCHED_NAME='DolphinScheduler' WHERE SCHED_NAME='EasyScheduler'; |
|
||||||
UPDATE QRTZ_JOB_DETAILS SET JOB_CLASS_NAME='org.apache.dolphinscheduler.dao.quartz.ProcessScheduleJob' WHERE JOB_CLASS_NAME='cn.escheduler.server.quartz.ProcessScheduleJob'; |
|
||||||
UPDATE QRTZ_LOCKS SET SCHED_NAME='DolphinScheduler' WHERE SCHED_NAME='EasyScheduler'; |
|
||||||
UPDATE QRTZ_SCHEDULER_STATE SET SCHED_NAME='DolphinScheduler' WHERE SCHED_NAME='EasyScheduler'; |
|
||||||
UPDATE t_ds_user SET phone = '' WHERE phone = 'xx'; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,278 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
-- uc_dolphin_T_t_ds_process_definition_A_modify_by |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_definition_A_modify_by; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_process_definition_A_modify_by() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_process_definition' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='modify_by') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_definition ADD `modify_by` varchar(36) DEFAULT '' COMMENT 'modify user'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_process_definition_A_modify_by; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_process_definition_A_modify_by; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_task_instance_A_executor_id |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_task_instance_A_executor_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_task_instance_A_executor_id() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_task_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='executor_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_task_instance ADD `executor_id` int(11) DEFAULT NULL COMMENT 'executor id'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_task_instance_A_executor_id; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_A_executor_id; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_task_instance_C_app_link |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_task_instance_C_app_link; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_task_instance_C_app_link() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_task_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='app_link') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_task_instance CHANGE `app_link` `app_link` text COMMENT 'yarn app id'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_task_instance_C_app_link; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_C_app_link; |
|
||||||
|
|
||||||
-- ac_dolphin_T_t_ds_resources_A_pid |
|
||||||
drop PROCEDURE if EXISTS ac_dolphin_T_t_ds_resources_A_pid; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_dolphin_T_t_ds_resources_A_pid() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_resources' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='pid') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources ADD `pid` int(11) DEFAULT -1 COMMENT 'parent id'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_dolphin_T_t_ds_resources_A_pid; |
|
||||||
DROP PROCEDURE ac_dolphin_T_t_ds_resources_A_pid; |
|
||||||
|
|
||||||
-- ac_dolphin_T_t_ds_resources_A_full_name |
|
||||||
drop PROCEDURE if EXISTS ac_dolphin_T_t_ds_resources_A_full_name; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_dolphin_T_t_ds_resources_A_full_name() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_resources' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='full_name') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources ADD `full_name` varchar(255) DEFAULT NULL COMMENT 'full name'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_dolphin_T_t_ds_resources_A_full_name; |
|
||||||
DROP PROCEDURE ac_dolphin_T_t_ds_resources_A_full_name; |
|
||||||
|
|
||||||
-- ac_dolphin_T_t_ds_resources_A_pid |
|
||||||
drop PROCEDURE if EXISTS ac_dolphin_T_t_ds_resources_is_directory; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_dolphin_T_t_ds_resources_is_directory() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_resources' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='is_directory') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources ADD `is_directory` tinyint(1) DEFAULT 0 COMMENT 'is directory'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_dolphin_T_t_ds_resources_is_directory; |
|
||||||
DROP PROCEDURE ac_dolphin_T_t_ds_resources_is_directory; |
|
||||||
|
|
||||||
-- ac_dolphin_T_t_ds_process_definition_A_resource_ids |
|
||||||
drop PROCEDURE if EXISTS ac_dolphin_T_t_ds_process_definition_A_resource_ids; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE ac_dolphin_T_t_ds_process_definition_A_resource_ids() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_process_definition' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='resource_ids') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_definition ADD `resource_ids` varchar(255) DEFAULT NULL COMMENT 'resource ids'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL ac_dolphin_T_t_ds_process_definition_A_resource_ids; |
|
||||||
DROP PROCEDURE ac_dolphin_T_t_ds_process_definition_A_resource_ids; |
|
||||||
|
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_process_instance_R_worker_group_id |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_instance_R_worker_group_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_process_instance_R_worker_group_id() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_process_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_instance change `worker_group_id` `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_process_instance_R_worker_group_id; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_process_instance_R_worker_group_id; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_task_instance_R_worker_group_id |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_task_instance_R_worker_group_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_task_instance_R_worker_group_id() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_task_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_task_instance change `worker_group_id` `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_task_instance_R_worker_group_id; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_R_worker_group_id; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_schedules_R_worker_group_id |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_schedules_R_worker_group_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_schedules_R_worker_group_id() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_schedules' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_schedules change `worker_group_id` `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_schedules_R_worker_group_id; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_schedules_R_worker_group_id; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_command_R_worker_group_id |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_command_R_worker_group_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_command_R_worker_group_id() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_command' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_command change `worker_group_id` `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_command_R_worker_group_id; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_command_R_worker_group_id; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_error_command_R_worker_group_id |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_error_command_R_worker_group_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_error_command_R_worker_group_id() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_error_command' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_error_command change `worker_group_id` `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_error_command_R_worker_group_id; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_error_command_R_worker_group_id; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_process_definition_A_process_definition_unique |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_definition_A_process_definition_unique; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_process_definition_A_process_definition_unique() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.STATISTICS |
|
||||||
WHERE TABLE_NAME='t_ds_process_definition' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND INDEX_NAME ='process_definition_unique') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_definition ADD UNIQUE KEY `process_definition_unique` (`name`,`project_id`); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_process_definition_A_process_definition_unique; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_process_definition_A_process_definition_unique; |
|
@ -1,27 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
SET FOREIGN_KEY_CHECKS=0; |
|
||||||
UPDATE t_ds_resources SET pid=-1,is_directory=false WHERE pid IS NULL; |
|
||||||
UPDATE t_ds_resources SET full_name = concat('/',alias) WHERE pid=-1 and full_name IS NULL; |
|
||||||
UPDATE QRTZ_JOB_DETAILS SET JOB_CLASS_NAME='org.apache.dolphinscheduler.service.quartz.ProcessScheduleJob' WHERE JOB_CLASS_NAME='org.apache.dolphinscheduler.server.quartz.ProcessScheduleJob'; |
|
||||||
UPDATE t_ds_process_instance instance SET `worker_group`=IFNULL((SELECT name from t_ds_worker_group WHERE instance.worker_group=CONCAT(id,'')),'default'); |
|
||||||
UPDATE t_ds_task_instance instance SET `worker_group`=IFNULL((SELECT name from t_ds_worker_group WHERE instance.worker_group=CONCAT(id,'')),'default'); |
|
||||||
UPDATE t_ds_schedules schedule SET `worker_group`=IFNULL((SELECT name from t_ds_worker_group WHERE schedule.worker_group=CONCAT(id,'')),'default'); |
|
||||||
UPDATE t_ds_command command SET `worker_group`=IFNULL((SELECT name from t_ds_worker_group WHERE command.worker_group=CONCAT(id,'')),'default'); |
|
||||||
UPDATE t_ds_error_command command SET `worker_group`=IFNULL((SELECT name from t_ds_worker_group WHERE command.worker_group=CONCAT(id,'')),'default'); |
|
||||||
UPDATE t_ds_user SET phone = '' WHERE phone = 'xx'; |
|
@ -1,283 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
-- uc_dolphin_T_t_ds_process_definition_A_modify_by |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_process_definition_A_modify_by() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_process_definition' |
|
||||||
AND COLUMN_NAME ='modify_by') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_definition ADD COLUMN modify_by varchar(36) DEFAULT ''; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_process_definition_A_modify_by(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_process_definition_A_modify_by(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_task_instance_A_executor_id |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_task_instance_A_executor_id() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_task_instance' |
|
||||||
AND COLUMN_NAME ='executor_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_task_instance ADD COLUMN executor_id int DEFAULT NULL; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_task_instance_A_executor_id(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_task_instance_A_executor_id(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_task_instance_C_app_link |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_task_instance_C_app_link() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_task_instance' |
|
||||||
AND COLUMN_NAME ='app_link') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_task_instance ALTER COLUMN app_link type text; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_task_instance_C_app_link(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_task_instance_C_app_link(); |
|
||||||
|
|
||||||
|
|
||||||
-- ac_dolphin_T_t_ds_resources_A_pid |
|
||||||
delimiter d// |
|
||||||
CREATE FUNCTION ac_dolphin_T_t_ds_resources_A_pid() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_CATALOG=current_database() |
|
||||||
AND TABLE_SCHEMA=current_schema() |
|
||||||
AND TABLE_NAME='t_ds_resources' |
|
||||||
AND COLUMN_NAME ='pid') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources ADD COLUMN pid int DEFAULT -1; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
select ac_dolphin_T_t_ds_resources_A_pid(); |
|
||||||
DROP FUNCTION ac_dolphin_T_t_ds_resources_A_pid(); |
|
||||||
|
|
||||||
-- ac_dolphin_T_t_ds_resources_A_full_name |
|
||||||
delimiter ; |
|
||||||
DROP FUNCTION IF EXISTS ac_dolphin_T_t_ds_resources_A_full_name(); |
|
||||||
delimiter d// |
|
||||||
CREATE FUNCTION ac_dolphin_T_t_ds_resources_A_full_name() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_CATALOG=current_database() |
|
||||||
AND TABLE_SCHEMA=current_schema() |
|
||||||
AND TABLE_NAME='t_ds_resources' |
|
||||||
AND COLUMN_NAME ='full_name') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources ADD COLUMN full_name varchar(255) DEFAULT null; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
select ac_dolphin_T_t_ds_resources_A_full_name(); |
|
||||||
DROP FUNCTION ac_dolphin_T_t_ds_resources_A_full_name(); |
|
||||||
|
|
||||||
-- ac_dolphin_T_t_ds_resources_A_is_directory |
|
||||||
delimiter ; |
|
||||||
DROP FUNCTION IF EXISTS ac_dolphin_T_t_ds_resources_A_is_directory(); |
|
||||||
delimiter d// |
|
||||||
CREATE FUNCTION ac_dolphin_T_t_ds_resources_A_is_directory() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_CATALOG=current_database() |
|
||||||
AND TABLE_SCHEMA=current_schema() |
|
||||||
AND TABLE_NAME='t_ds_resources' |
|
||||||
AND COLUMN_NAME ='is_directory') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources ADD COLUMN is_directory boolean DEFAULT false; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
select ac_dolphin_T_t_ds_resources_A_is_directory(); |
|
||||||
DROP FUNCTION ac_dolphin_T_t_ds_resources_A_is_directory(); |
|
||||||
|
|
||||||
-- ac_dolphin_T_t_ds_process_definition_A_resource_ids |
|
||||||
delimiter ; |
|
||||||
DROP FUNCTION IF EXISTS ac_dolphin_T_t_ds_process_definition_A_resource_ids(); |
|
||||||
delimiter d// |
|
||||||
CREATE FUNCTION ac_dolphin_T_t_ds_process_definition_A_resource_ids() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_CATALOG=current_database() |
|
||||||
AND TABLE_SCHEMA=current_schema() |
|
||||||
AND TABLE_NAME='t_ds_process_definition' |
|
||||||
AND COLUMN_NAME ='resource_ids') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_definition ADD COLUMN resource_ids varchar(255) DEFAULT null; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
select ac_dolphin_T_t_ds_process_definition_A_resource_ids(); |
|
||||||
DROP FUNCTION ac_dolphin_T_t_ds_process_definition_A_resource_ids(); |
|
||||||
|
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_process_instance_R_worker_group_id |
|
||||||
delimiter ; |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_process_instance_R_worker_group_id(); |
|
||||||
delimiter d// |
|
||||||
CREATE FUNCTION uc_dolphin_T_t_ds_process_instance_R_worker_group_id() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_CATALOG=current_database() |
|
||||||
AND TABLE_SCHEMA=current_schema() |
|
||||||
AND TABLE_NAME='t_ds_process_instance' |
|
||||||
AND COLUMN_NAME ='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_instance RENAME worker_group_id TO worker_group; |
|
||||||
ALTER TABLE t_ds_process_instance ALTER COLUMN worker_group type varchar(64); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
select uc_dolphin_T_t_ds_process_instance_R_worker_group_id(); |
|
||||||
DROP FUNCTION uc_dolphin_T_t_ds_process_instance_R_worker_group_id(); |
|
||||||
|
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_task_instance_R_worker_group_id |
|
||||||
delimiter ; |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_task_instance_R_worker_group_id(); |
|
||||||
delimiter d// |
|
||||||
CREATE FUNCTION uc_dolphin_T_t_ds_task_instance_R_worker_group_id() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_CATALOG=current_database() |
|
||||||
AND TABLE_SCHEMA=current_schema() |
|
||||||
AND TABLE_NAME='t_ds_task_instance' |
|
||||||
AND COLUMN_NAME ='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_task_instance rename worker_group_id to worker_group; |
|
||||||
ALTER TABLE t_ds_task_instance alter column worker_group type varchar(64); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
select uc_dolphin_T_t_ds_task_instance_R_worker_group_id(); |
|
||||||
DROP FUNCTION uc_dolphin_T_t_ds_task_instance_R_worker_group_id(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_schedules_R_worker_group_id |
|
||||||
delimiter ; |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_schedules_R_worker_group_id(); |
|
||||||
delimiter d// |
|
||||||
CREATE FUNCTION uc_dolphin_T_t_ds_schedules_R_worker_group_id() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_CATALOG=current_database() |
|
||||||
AND TABLE_SCHEMA=current_schema() |
|
||||||
AND TABLE_NAME='t_ds_schedules' |
|
||||||
AND COLUMN_NAME ='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_schedules rename worker_group_id to worker_group; |
|
||||||
ALTER TABLE t_ds_schedules alter column worker_group type varchar(64); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
select uc_dolphin_T_t_ds_schedules_R_worker_group_id(); |
|
||||||
DROP FUNCTION uc_dolphin_T_t_ds_schedules_R_worker_group_id(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_command_R_worker_group_id |
|
||||||
delimiter ; |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_command_R_worker_group_id(); |
|
||||||
delimiter d// |
|
||||||
CREATE FUNCTION uc_dolphin_T_t_ds_command_R_worker_group_id() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_CATALOG=current_database() |
|
||||||
AND TABLE_SCHEMA=current_schema() |
|
||||||
AND TABLE_NAME='t_ds_command' |
|
||||||
AND COLUMN_NAME ='worker_group') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_command rename worker_group_id to worker_group; |
|
||||||
ALTER TABLE t_ds_command alter column worker_group type varchar(64); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
select uc_dolphin_T_t_ds_command_R_worker_group_id(); |
|
||||||
DROP FUNCTION uc_dolphin_T_t_ds_command_R_worker_group_id(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_error_command_R_worker_group_id |
|
||||||
delimiter ; |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_error_command_R_worker_group_id(); |
|
||||||
delimiter d// |
|
||||||
CREATE FUNCTION uc_dolphin_T_t_ds_error_command_R_worker_group_id() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_CATALOG=current_database() |
|
||||||
AND TABLE_SCHEMA=current_schema() |
|
||||||
AND TABLE_NAME='t_ds_error_command' |
|
||||||
AND COLUMN_NAME ='worker_group_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_error_command rename worker_group_id to worker_group; |
|
||||||
ALTER TABLE t_ds_error_command alter column worker_group type varchar(64); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
select uc_dolphin_T_t_ds_error_command_R_worker_group_id(); |
|
||||||
DROP FUNCTION uc_dolphin_T_t_ds_error_command_R_worker_group_id(); |
|
||||||
|
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_process_definition_A_process_definition_unique |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_process_definition_A_process_definition_unique() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM pg_stat_all_indexes |
|
||||||
WHERE relname='t_ds_process_definition' |
|
||||||
AND indexrelname ='process_definition_unique') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_definition ADD CONSTRAINT process_definition_unique UNIQUE (name,project_id); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_process_definition_A_process_definition_unique(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_process_definition_A_process_definition_unique(); |
|
@ -1,25 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
UPDATE t_ds_resources SET pid=-1,is_directory=false WHERE pid IS NULL; |
|
||||||
UPDATE t_ds_resources SET full_name = concat('/',alias) WHERE pid=-1 and full_name IS NULL; |
|
||||||
UPDATE QRTZ_JOB_DETAILS SET JOB_CLASS_NAME='org.apache.dolphinscheduler.service.quartz.ProcessScheduleJob' WHERE JOB_CLASS_NAME='org.apache.dolphinscheduler.server.quartz.ProcessScheduleJob'; |
|
||||||
UPDATE t_ds_process_instance instance SET worker_group=COALESCE((SELECT name from t_ds_worker_group WHERE instance.worker_group=CONCAT(id,'')),'default'); |
|
||||||
UPDATE t_ds_task_instance instance SET worker_group=COALESCE((SELECT name from t_ds_worker_group WHERE instance.worker_group=CONCAT(id,'')),'default'); |
|
||||||
UPDATE t_ds_schedules schedule SET worker_group=COALESCE((SELECT name from t_ds_worker_group WHERE schedule.worker_group=CONCAT(id,'')),'default'); |
|
||||||
UPDATE t_ds_command command SET worker_group=COALESCE((SELECT name from t_ds_worker_group WHERE command.worker_group=CONCAT(id,'')),'default'); |
|
||||||
UPDATE t_ds_error_command command SET worker_group=COALESCE((SELECT name from t_ds_worker_group WHERE command.worker_group=CONCAT(id,'')),'default'); |
|
||||||
UPDATE t_ds_user SET phone = '' WHERE phone = 'xx'; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,19 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
SET FOREIGN_KEY_CHECKS=0; |
|
||||||
UPDATE t_ds_user SET phone = '' WHERE phone = 'xx'; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,17 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
UPDATE t_ds_user SET phone = '' WHERE phone = 'xx'; |
|
@ -1,40 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
|
|
||||||
|
|
||||||
-- add t_ds_resources_un |
|
||||||
DROP PROCEDURE IF EXISTS uc_dolphin_T_t_ds_resources_un; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_resources_un() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS ( |
|
||||||
SELECT * FROM information_schema.KEY_COLUMN_USAGE |
|
||||||
WHERE TABLE_NAME = 't_ds_resources' |
|
||||||
AND CONSTRAINT_NAME = 't_ds_resources_un' |
|
||||||
) |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources ADD CONSTRAINT t_ds_resources_un UNIQUE KEY (full_name,`type`); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_resources_un(); |
|
||||||
DROP PROCEDURE IF EXISTS uc_dolphin_T_t_ds_resources_un; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,34 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
-- add t_ds_resources_un |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_resources_un() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.KEY_COLUMN_USAGE |
|
||||||
WHERE TABLE_NAME = 't_ds_resources' |
|
||||||
AND CONSTRAINT_NAME = 't_ds_resources_un') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources ADD CONSTRAINT t_ds_resources_un UNIQUE (full_name,"type"); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_resources_un(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_resources_un(); |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,58 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_process_instance_R_host |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_instance_R_host; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_process_instance_R_host() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_process_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='host') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_instance MODIFY COLUMN `host` varchar(135); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_process_instance_R_host; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_process_instance_R_host; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_task_instance_R_host |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_task_instance_R_host; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_task_instance_R_host() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_task_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='host') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_task_instance MODIFY COLUMN `host` varchar(135); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_task_instance_R_host; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_R_host; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,52 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_process_instance_A_host |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_process_instance_A_host() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_process_instance' |
|
||||||
AND COLUMN_NAME ='host') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_instance ALTER COLUMN host type varchar(135); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_process_instance_A_host(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_process_instance_A_host(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_task_instance_A_host |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_task_instance_A_host() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_task_instance' |
|
||||||
AND COLUMN_NAME ='host') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_task_instance ALTER COLUMN host type varchar(135); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_task_instance_A_host(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_task_instance_A_host(); |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,60 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_worker_group_R_ip_list |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_worker_group_R_ip_list; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_worker_group_R_ip_list() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_worker_group' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='ip_list') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_worker_group CHANGE COLUMN `ip_list` `addr_list` text; |
|
||||||
ALTER TABLE t_ds_worker_group MODIFY COLUMN `name` varchar(255) NOT NULL; |
|
||||||
ALTER TABLE t_ds_worker_group ADD UNIQUE KEY `name_unique` (`name`); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_worker_group_R_ip_list; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_worker_group_R_ip_list; |
|
||||||
|
|
||||||
-- uc_dolphin_T_qrtz_fired_triggers_R_entry_id |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_qrtz_fired_triggers_R_entry_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_qrtz_fired_triggers_R_entry_id() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='QRTZ_FIRED_TRIGGERS' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='entry_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE QRTZ_FIRED_TRIGGERS MODIFY COLUMN `entry_id` varchar(200); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_qrtz_fired_triggers_R_entry_id; |
|
||||||
DROP PROCEDURE uc_dolphin_T_qrtz_fired_triggers_R_entry_id; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,59 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_worker_group_A_ip_list |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_worker_group_A_ip_list() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_worker_group' |
|
||||||
AND COLUMN_NAME ='ip_list') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_worker_group RENAME ip_list TO addr_list; |
|
||||||
ALTER TABLE t_ds_worker_group ALTER COLUMN addr_list type text; |
|
||||||
ALTER TABLE t_ds_worker_group ALTER COLUMN name type varchar(255), ALTER COLUMN name SET NOT NULL; |
|
||||||
ALTER TABLE t_ds_worker_group ADD CONSTRAINT name_unique UNIQUE (name); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_worker_group_A_ip_list(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_worker_group_A_ip_list(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_qrtz_fired_triggers_A_entry_id |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_qrtz_fired_triggers_A_entry_id() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='qrtz_fired_triggers' |
|
||||||
AND COLUMN_NAME ='entry_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE qrtz_fired_triggers ALTER COLUMN entry_id type varchar(200); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_qrtz_fired_triggers_A_entry_id(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_qrtz_fired_triggers_A_entry_id(); |
|
||||||
|
|
||||||
-- Add foreign key constraints for t_ds_task_instance -- |
|
||||||
delimiter ; |
|
||||||
ALTER TABLE t_ds_task_instance ADD CONSTRAINT foreign_key_instance_id FOREIGN KEY(process_instance_id) REFERENCES t_ds_process_instance(id) ON DELETE CASCADE; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,119 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_datasource_R_note |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_datasource_R_note; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_datasource_R_note() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_datasource' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='note') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_datasource MODIFY COLUMN `note` varchar(255) DEFAULT NULL COMMENT 'description'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_datasource_R_note; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_datasource_R_note; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_resources_R_description |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_resources_R_description; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_resources_R_description() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_resources' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='description') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources MODIFY COLUMN `description` varchar(255) DEFAULT NULL; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_resources_R_description; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_resources_R_description; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_schedules_R_crontab |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_schedules_R_crontab; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_schedules_R_crontab() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_schedules' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='crontab') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_schedules MODIFY COLUMN `crontab` varchar(255) NOT NULL COMMENT 'crontab description'; |
|
||||||
ALTER TABLE t_ds_schedules MODIFY COLUMN `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group id'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_schedules_R_crontab; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_schedules_R_crontab; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_tenant_R_description |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_tenant_R_description; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_tenant_R_description() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_tenant' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='description') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_tenant MODIFY COLUMN `description` varchar(255) DEFAULT NULL; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_tenant_R_description; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_tenant_R_description; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_worker_group_R_name |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_worker_group_R_name; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_worker_group_R_name() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_worker_group' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='name') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_worker_group MODIFY COLUMN `name` varchar(255) NOT NULL COMMENT 'worker group name'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_worker_group_R_name; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_worker_group_R_name; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,106 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_datasource_A_note |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_datasource_A_note() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_datasource' |
|
||||||
AND COLUMN_NAME ='note') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_datasource ALTER COLUMN note type varchar(255); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_datasource_A_note(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_datasource_A_note(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_resources_A_description |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_resources_A_description() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_resources' |
|
||||||
AND COLUMN_NAME ='description') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources ALTER COLUMN description type varchar(255); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_resources_A_description(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_resources_A_description(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_schedules_A_crontab |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_schedules_A_crontab() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_schedules' |
|
||||||
AND COLUMN_NAME ='crontab') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_schedules ALTER COLUMN crontab type varchar(255); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_schedules_A_crontab(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_schedules_A_crontab(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_tenant_A_description |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_tenant_A_description() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_tenant' |
|
||||||
AND COLUMN_NAME ='description') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_tenant ALTER COLUMN description type varchar(255); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_tenant_A_description(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_tenant_A_description(); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_worker_group_A_name |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_worker_group_A_name() RETURNS void AS $$ |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_worker_group' |
|
||||||
AND COLUMN_NAME ='name') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_worker_group ALTER COLUMN name type varchar(255); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
$$ LANGUAGE plpgsql; |
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
SELECT uc_dolphin_T_t_ds_worker_group_A_name(); |
|
||||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_worker_group_A_name(); |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,445 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_user_A_state |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_user_A_state; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_user_A_state() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_user' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='state') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_user ADD `state` tinyint(4) DEFAULT '1' COMMENT 'state 0:disable 1:enable'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_user_A_state; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_user_A_state; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_tenant_A_tenant_name |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_tenant_A_tenant_name; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_tenant_A_tenant_name() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_tenant' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='tenant_name') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_tenant DROP `tenant_name`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_tenant_A_tenant_name; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_tenant_A_tenant_name; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_alertgroup_A_alert_instance_ids |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_alertgroup_A_alert_instance_ids; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_alertgroup_A_alert_instance_ids() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_alertgroup' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='alert_instance_ids') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_alertgroup ADD COLUMN `alert_instance_ids` varchar (255) DEFAULT NULL COMMENT 'alert instance ids' AFTER `id`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_alertgroup_A_alert_instance_ids(); |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_alertgroup_A_alert_instance_ids; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_alertgroup_A_create_user_id |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_alertgroup_A_create_user_id; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_alertgroup_A_create_user_id() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_alertgroup' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='create_user_id') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_alertgroup ADD COLUMN `create_user_id` int(11) DEFAULT NULL COMMENT 'create user id' AFTER `alert_instance_ids`; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_alertgroup_A_create_user_id(); |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_alertgroup_A_create_user_id; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_alertgroup_A_add_UN_groupName |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_alertgroup_A_add_UN_groupName; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_alertgroup_A_add_UN_groupName() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.STATISTICS |
|
||||||
WHERE TABLE_NAME='t_ds_alertgroup' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND INDEX_NAME ='t_ds_alertgroup_name_un') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_alertgroup ADD UNIQUE KEY `t_ds_alertgroup_name_un` (`group_name`); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_alertgroup_A_add_UN_groupName(); |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_alertgroup_A_add_UN_groupName; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_datasource_A_add_UN_datasourceName |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_datasource_A_add_UN_datasourceName; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_datasource_A_add_UN_datasourceName() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.STATISTICS |
|
||||||
WHERE TABLE_NAME='t_ds_datasource' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND INDEX_NAME ='t_ds_datasource_name_un') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_datasource ADD UNIQUE KEY `t_ds_datasource_name_un` (`name`, `type`); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_datasource_A_add_UN_datasourceName(); |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_datasource_A_add_UN_datasourceName; |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_project_A_add_code |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_project_A_add_code; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_project_A_add_code() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_project' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='code') |
|
||||||
THEN |
|
||||||
alter table t_ds_project add `code` bigint(20) COMMENT 'encoding' AFTER `name`; |
|
||||||
-- update default value for not null |
|
||||||
UPDATE t_ds_project SET code = id; |
|
||||||
alter table t_ds_project modify `code` bigint(20) NOT NULL; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_project_A_add_code(); |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_project_A_add_code; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_ds_plugin_define |
|
||||||
-- ---------------------------- |
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
DROP TABLE IF EXISTS `t_ds_plugin_define`; |
|
||||||
CREATE TABLE `t_ds_plugin_define` ( |
|
||||||
`id` int NOT NULL AUTO_INCREMENT, |
|
||||||
`plugin_name` varchar(100) NOT NULL COMMENT 'the name of plugin eg: email', |
|
||||||
`plugin_type` varchar(100) NOT NULL COMMENT 'plugin type . alert=alert plugin, job=job plugin', |
|
||||||
`plugin_params` text COMMENT 'plugin params', |
|
||||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
|
||||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
UNIQUE KEY `t_ds_plugin_define_UN` (`plugin_name`,`plugin_type`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_ds_alert_plugin_instance |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_ds_alert_plugin_instance`; |
|
||||||
CREATE TABLE `t_ds_alert_plugin_instance` ( |
|
||||||
`id` int NOT NULL AUTO_INCREMENT, |
|
||||||
`plugin_define_id` int NOT NULL, |
|
||||||
`plugin_instance_params` text COMMENT 'plugin instance params. Also contain the params value which user input in web ui.', |
|
||||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP, |
|
||||||
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
|
||||||
`instance_name` varchar(200) DEFAULT NULL COMMENT 'alert instance name', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_ds_environment |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_ds_environment`; |
|
||||||
CREATE TABLE `t_ds_environment` ( |
|
||||||
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'id', |
|
||||||
`code` bigint(20) DEFAULT NULL COMMENT 'encoding', |
|
||||||
`name` varchar(100) NOT NULL COMMENT 'environment name', |
|
||||||
`config` text NULL DEFAULT NULL COMMENT 'this config contains many environment variables config', |
|
||||||
`description` text NULL DEFAULT NULL COMMENT 'the details', |
|
||||||
`operator` int(11) DEFAULT NULL COMMENT 'operator user id', |
|
||||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP, |
|
||||||
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
UNIQUE KEY `environment_name_unique` (`name`), |
|
||||||
UNIQUE KEY `environment_code_unique` (`code`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_ds_environment_worker_group_relation |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_ds_environment_worker_group_relation`; |
|
||||||
CREATE TABLE `t_ds_environment_worker_group_relation` ( |
|
||||||
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'id', |
|
||||||
`environment_code` bigint(20) NOT NULL COMMENT 'environment code', |
|
||||||
`worker_group` varchar(255) NOT NULL COMMENT 'worker group id', |
|
||||||
`operator` int(11) DEFAULT NULL COMMENT 'operator user id', |
|
||||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP, |
|
||||||
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
UNIQUE KEY `environment_worker_group_unique` (`environment_code`,`worker_group`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_ds_process_definition_log |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_ds_process_definition_log`; |
|
||||||
CREATE TABLE `t_ds_process_definition_log` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id', |
|
||||||
`code` bigint(20) NOT NULL COMMENT 'encoding', |
|
||||||
`name` varchar(200) DEFAULT NULL COMMENT 'process definition name', |
|
||||||
`version` int(11) DEFAULT '0' COMMENT 'process definition version', |
|
||||||
`description` text COMMENT 'description', |
|
||||||
`project_code` bigint(20) NOT NULL COMMENT 'project code', |
|
||||||
`release_state` tinyint(4) DEFAULT NULL COMMENT 'process definition release state:0:offline,1:online', |
|
||||||
`user_id` int(11) DEFAULT NULL COMMENT 'process definition creator id', |
|
||||||
`global_params` text COMMENT 'global parameters', |
|
||||||
`flag` tinyint(4) DEFAULT NULL COMMENT '0 not available, 1 available', |
|
||||||
`locations` text COMMENT 'Node location information', |
|
||||||
`warning_group_id` int(11) DEFAULT NULL COMMENT 'alert group id', |
|
||||||
`timeout` int(11) DEFAULT '0' COMMENT 'time out,unit: minute', |
|
||||||
`tenant_id` int(11) NOT NULL DEFAULT '-1' COMMENT 'tenant id', |
|
||||||
`execution_type` tinyint(4) DEFAULT '0' COMMENT 'execution_type 0:parallel,1:serial wait,2:serial discard,3:serial priority', |
|
||||||
`operator` int(11) DEFAULT NULL COMMENT 'operator user id', |
|
||||||
`operate_time` datetime DEFAULT NULL COMMENT 'operate time', |
|
||||||
`create_time` datetime NOT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime NOT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_ds_task_definition |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_ds_task_definition`; |
|
||||||
CREATE TABLE `t_ds_task_definition` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id', |
|
||||||
`code` bigint(20) NOT NULL COMMENT 'encoding', |
|
||||||
`name` varchar(200) DEFAULT NULL COMMENT 'task definition name', |
|
||||||
`version` int(11) DEFAULT '0' COMMENT 'task definition version', |
|
||||||
`description` text COMMENT 'description', |
|
||||||
`project_code` bigint(20) NOT NULL COMMENT 'project code', |
|
||||||
`user_id` int(11) DEFAULT NULL COMMENT 'task definition creator id', |
|
||||||
`task_type` varchar(50) NOT NULL COMMENT 'task type', |
|
||||||
`task_params` longtext COMMENT 'job custom parameters', |
|
||||||
`flag` tinyint(2) DEFAULT NULL COMMENT '0 not available, 1 available', |
|
||||||
`task_priority` tinyint(4) DEFAULT NULL COMMENT 'job priority', |
|
||||||
`worker_group` varchar(200) DEFAULT NULL COMMENT 'worker grouping', |
|
||||||
`environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code', |
|
||||||
`fail_retry_times` int(11) DEFAULT NULL COMMENT 'number of failed retries', |
|
||||||
`fail_retry_interval` int(11) DEFAULT NULL COMMENT 'failed retry interval', |
|
||||||
`timeout_flag` tinyint(2) DEFAULT '0' COMMENT 'timeout flag:0 close, 1 open', |
|
||||||
`timeout_notify_strategy` tinyint(4) DEFAULT NULL COMMENT 'timeout notification policy: 0 warning, 1 fail', |
|
||||||
`timeout` int(11) DEFAULT '0' COMMENT 'timeout length,unit: minute', |
|
||||||
`delay_time` int(11) DEFAULT '0' COMMENT 'delay execution time,unit: minute', |
|
||||||
`resource_ids` text COMMENT 'resource id, separated by comma', |
|
||||||
`create_time` datetime NOT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime NOT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`,`code`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_ds_task_definition_log |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_ds_task_definition_log`; |
|
||||||
CREATE TABLE `t_ds_task_definition_log` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id', |
|
||||||
`code` bigint(20) NOT NULL COMMENT 'encoding', |
|
||||||
`name` varchar(200) DEFAULT NULL COMMENT 'task definition name', |
|
||||||
`version` int(11) DEFAULT '0' COMMENT 'task definition version', |
|
||||||
`description` text COMMENT 'description', |
|
||||||
`project_code` bigint(20) NOT NULL COMMENT 'project code', |
|
||||||
`user_id` int(11) DEFAULT NULL COMMENT 'task definition creator id', |
|
||||||
`task_type` varchar(50) NOT NULL COMMENT 'task type', |
|
||||||
`task_params` longtext COMMENT 'job custom parameters', |
|
||||||
`flag` tinyint(2) DEFAULT NULL COMMENT '0 not available, 1 available', |
|
||||||
`task_priority` tinyint(4) DEFAULT NULL COMMENT 'job priority', |
|
||||||
`worker_group` varchar(200) DEFAULT NULL COMMENT 'worker grouping', |
|
||||||
`environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code', |
|
||||||
`fail_retry_times` int(11) DEFAULT NULL COMMENT 'number of failed retries', |
|
||||||
`fail_retry_interval` int(11) DEFAULT NULL COMMENT 'failed retry interval', |
|
||||||
`timeout_flag` tinyint(2) DEFAULT '0' COMMENT 'timeout flag:0 close, 1 open', |
|
||||||
`timeout_notify_strategy` tinyint(4) DEFAULT NULL COMMENT 'timeout notification policy: 0 warning, 1 fail', |
|
||||||
`timeout` int(11) DEFAULT '0' COMMENT 'timeout length,unit: minute', |
|
||||||
`delay_time` int(11) DEFAULT '0' COMMENT 'delay execution time,unit: minute', |
|
||||||
`resource_ids` text DEFAULT NULL COMMENT 'resource id, separated by comma', |
|
||||||
`operator` int(11) DEFAULT NULL COMMENT 'operator user id', |
|
||||||
`task_group_id` int(11) DEFAULT NULL COMMENT 'task group id', |
|
||||||
`operate_time` datetime DEFAULT NULL COMMENT 'operate time', |
|
||||||
`create_time` datetime NOT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime NOT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_ds_process_task_relation |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_ds_process_task_relation`; |
|
||||||
CREATE TABLE `t_ds_process_task_relation` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id', |
|
||||||
`name` varchar(200) DEFAULT NULL COMMENT 'relation name', |
|
||||||
`project_code` bigint(20) NOT NULL COMMENT 'project code', |
|
||||||
`process_definition_code` bigint(20) NOT NULL COMMENT 'process code', |
|
||||||
`process_definition_version` int(11) NOT NULL COMMENT 'process version', |
|
||||||
`pre_task_code` bigint(20) NOT NULL COMMENT 'pre task code', |
|
||||||
`pre_task_version` int(11) NOT NULL COMMENT 'pre task version', |
|
||||||
`post_task_code` bigint(20) NOT NULL COMMENT 'post task code', |
|
||||||
`post_task_version` int(11) NOT NULL COMMENT 'post task version', |
|
||||||
`condition_type` tinyint(2) DEFAULT NULL COMMENT 'condition type : 0 none, 1 judge 2 delay', |
|
||||||
`condition_params` text COMMENT 'condition params(json)', |
|
||||||
`create_time` datetime NOT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime NOT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_ds_process_task_relation_log |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_ds_process_task_relation_log`; |
|
||||||
CREATE TABLE `t_ds_process_task_relation_log` ( |
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id', |
|
||||||
`name` varchar(200) DEFAULT NULL COMMENT 'relation name', |
|
||||||
`project_code` bigint(20) NOT NULL COMMENT 'project code', |
|
||||||
`process_definition_code` bigint(20) NOT NULL COMMENT 'process code', |
|
||||||
`process_definition_version` int(11) NOT NULL COMMENT 'process version', |
|
||||||
`pre_task_code` bigint(20) NOT NULL COMMENT 'pre task code', |
|
||||||
`pre_task_version` int(11) NOT NULL COMMENT 'pre task version', |
|
||||||
`post_task_code` bigint(20) NOT NULL COMMENT 'post task code', |
|
||||||
`post_task_version` int(11) NOT NULL COMMENT 'post task version', |
|
||||||
`condition_type` tinyint(2) DEFAULT NULL COMMENT 'condition type : 0 none, 1 judge 2 delay', |
|
||||||
`condition_params` text COMMENT 'condition params(json)', |
|
||||||
`operator` int(11) DEFAULT NULL COMMENT 'operator user id', |
|
||||||
`operate_time` datetime DEFAULT NULL COMMENT 'operate time', |
|
||||||
`create_time` datetime NOT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime NOT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- t_ds_worker_group |
|
||||||
DROP TABLE IF EXISTS `t_ds_worker_group`; |
|
||||||
CREATE TABLE `t_ds_worker_group` ( |
|
||||||
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'id', |
|
||||||
`name` varchar(255) NOT NULL COMMENT 'worker group name', |
|
||||||
`addr_list` text NULL DEFAULT NULL COMMENT 'worker addr list. split by [,]', |
|
||||||
`create_time` datetime NULL DEFAULT NULL COMMENT 'create time', |
|
||||||
`update_time` datetime NULL DEFAULT NULL COMMENT 'update time', |
|
||||||
PRIMARY KEY (`id`), |
|
||||||
UNIQUE KEY `name_unique` (`name`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- ---------------------------- |
|
||||||
-- Table structure for t_ds_audit_log |
|
||||||
-- ---------------------------- |
|
||||||
DROP TABLE IF EXISTS `t_ds_audit_log`; |
|
||||||
CREATE TABLE `t_ds_audit_log` ( |
|
||||||
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT'key', |
|
||||||
`user_id` int(11) NOT NULL COMMENT 'user id', |
|
||||||
`resource_type` int(11) NOT NULL COMMENT 'resource type', |
|
||||||
`operation` int(11) NOT NULL COMMENT 'operation', |
|
||||||
`time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'create time', |
|
||||||
`resource_id` int(11) NULL DEFAULT NULL COMMENT 'resource id', |
|
||||||
PRIMARY KEY (`id`) |
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT= 1 DEFAULT CHARSET=utf8; |
|
||||||
|
|
||||||
-- t_ds_command |
|
||||||
alter table t_ds_command change process_definition_id process_definition_code bigint(20) NOT NULL COMMENT 'process definition code'; |
|
||||||
alter table t_ds_command add environment_code bigint(20) DEFAULT '-1' COMMENT 'environment code' AFTER worker_group; |
|
||||||
alter table t_ds_command add dry_run tinyint(4) DEFAULT '0' COMMENT 'dry run flag:0 normal, 1 dry run' AFTER environment_code; |
|
||||||
alter table t_ds_command add process_definition_version int(11) DEFAULT '0' COMMENT 'process definition version' AFTER process_definition_code; |
|
||||||
alter table t_ds_command add process_instance_id int(11) DEFAULT '0' COMMENT 'process instance id' AFTER process_definition_version; |
|
||||||
alter table t_ds_command add KEY `priority_id_index` (`process_instance_priority`,`id`) USING BTREE; |
|
||||||
|
|
||||||
-- t_ds_error_command |
|
||||||
alter table t_ds_error_command change process_definition_id process_definition_code bigint(20) NOT NULL COMMENT 'process definition code'; |
|
||||||
alter table t_ds_error_command add environment_code bigint(20) DEFAULT '-1' COMMENT 'environment code' AFTER worker_group; |
|
||||||
alter table t_ds_error_command add dry_run tinyint(4) DEFAULT '0' COMMENT 'dry run flag:0 normal, 1 dry run' AFTER message; |
|
||||||
alter table t_ds_error_command add process_definition_version int(11) DEFAULT '0' COMMENT 'process definition version' AFTER process_definition_code; |
|
||||||
alter table t_ds_error_command add process_instance_id int(11) DEFAULT '0' COMMENT 'process instance id' AFTER process_definition_version; |
|
||||||
|
|
||||||
-- t_ds_process_instance note: Data migration is not supported |
|
||||||
alter table t_ds_process_instance change process_definition_id process_definition_code bigint(20) NOT NULL COMMENT 'process definition code'; |
|
||||||
alter table t_ds_process_instance add process_definition_version int(11) DEFAULT '0' COMMENT 'process definition version' AFTER process_definition_code; |
|
||||||
alter table t_ds_process_instance add environment_code bigint(20) DEFAULT '-1' COMMENT 'environment code' AFTER worker_group; |
|
||||||
alter table t_ds_process_instance add var_pool longtext COMMENT 'var_pool' AFTER tenant_id; |
|
||||||
alter table t_ds_process_instance add dry_run tinyint(4) DEFAULT '0' COMMENT 'dry run flag:0 normal, 1 dry run' AFTER var_pool; |
|
||||||
alter table t_ds_process_instance add next_process_instance_id int(11) DEFAULT '0' COMMENT 'serial queue next processInstanceId' AFTER dry_run; |
|
||||||
alter table t_ds_process_instance drop KEY `process_instance_index`; |
|
||||||
alter table t_ds_process_instance add KEY `process_instance_index` (`process_definition_code`,`id`) USING BTREE; |
|
||||||
alter table t_ds_process_instance add KEY `process_instance_code_state_index` (`process_definition_code`,`state`) USING BTREE; |
|
||||||
alter table t_ds_process_instance drop process_instance_json; |
|
||||||
alter table t_ds_process_instance drop locations; |
|
||||||
alter table t_ds_process_instance drop connects; |
|
||||||
alter table t_ds_process_instance drop dependence_schedule_times; |
|
||||||
|
|
||||||
-- t_ds_task_instance note: Data migration is not supported |
|
||||||
alter table t_ds_task_instance change process_definition_id task_code bigint(20) NOT NULL COMMENT 'task definition code'; |
|
||||||
alter table t_ds_task_instance add task_definition_version int(11) DEFAULT '1' COMMENT 'task definition version' AFTER task_code; |
|
||||||
alter table t_ds_task_instance add task_params text COMMENT 'job custom parameters' AFTER app_link; |
|
||||||
alter table t_ds_task_instance add environment_code bigint(20) DEFAULT '-1' COMMENT 'environment code' AFTER worker_group; |
|
||||||
alter table t_ds_task_instance add environment_config text COMMENT 'this config contains many environment variables config' AFTER environment_code; |
|
||||||
alter table t_ds_task_instance add first_submit_time datetime DEFAULT NULL COMMENT 'task first submit time' AFTER executor_id; |
|
||||||
alter table t_ds_task_instance add delay_time int(4) DEFAULT '0' COMMENT 'task delay execution time' AFTER first_submit_time; |
|
||||||
alter table t_ds_task_instance add var_pool longtext COMMENT 'var_pool' AFTER delay_time; |
|
||||||
alter table t_ds_task_instance add dry_run tinyint(4) DEFAULT '0' COMMENT 'dry run flag:0 normal, 1 dry run' AFTER var_pool; |
|
||||||
alter table t_ds_task_instance drop KEY `task_instance_index`; |
|
||||||
alter table t_ds_task_instance drop task_json; |
|
||||||
|
|
||||||
-- t_ds_schedules |
|
||||||
alter table t_ds_schedules change process_definition_id process_definition_code bigint(20) NOT NULL COMMENT 'process definition code'; |
|
||||||
alter table t_ds_schedules add timezone_id varchar(40) DEFAULT NULL COMMENT 'timezoneId' AFTER end_time; |
|
||||||
alter table t_ds_schedules add environment_code bigint(20) DEFAULT '-1' COMMENT 'environment code' AFTER worker_group; |
|
||||||
|
|
||||||
-- t_ds_process_definition |
|
||||||
alter table t_ds_process_definition add `code` bigint(20) COMMENT 'encoding' AFTER `id`; |
|
||||||
-- update default value for not null |
|
||||||
UPDATE t_ds_process_definition SET code = id; |
|
||||||
alter table t_ds_process_definition modify `code` bigint(20) NOT NULL; |
|
||||||
alter table t_ds_process_definition change project_id project_code bigint(20) NOT NULL COMMENT 'project code' AFTER `description`; |
|
||||||
alter table t_ds_process_definition add `warning_group_id` int(11) DEFAULT NULL COMMENT 'alert group id' AFTER `locations`; |
|
||||||
alter table t_ds_process_definition add UNIQUE KEY `process_unique` (`name`,`project_code`) USING BTREE; |
|
||||||
alter table t_ds_process_definition modify `description` text COMMENT 'description' after `version`; |
|
||||||
alter table t_ds_process_definition modify `release_state` tinyint(4) DEFAULT NULL COMMENT 'process definition release state:0:offline,1:online' after `project_code`; |
|
||||||
alter table t_ds_process_definition add `execution_type` tinyint(4) DEFAULT '0' COMMENT 'execution_type 0:parallel,1:serial wait,2:serial discard,3:serial priority' after `tenant_id`; |
|
||||||
alter table t_ds_process_definition modify `create_time` datetime DEFAULT NULL COMMENT 'create time' after `execution_type`; |
|
@ -1,26 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
alter table t_ds_process_definition drop primary key, ADD PRIMARY KEY (`id`,`code`); |
|
||||||
ALTER TABLE t_ds_process_definition drop KEY `process_definition_unique`; |
|
||||||
ALTER TABLE t_ds_process_definition drop KEY `process_definition_index`; |
|
||||||
alter table t_ds_process_definition drop process_definition_json; |
|
||||||
alter table t_ds_process_definition drop connects; |
|
||||||
alter table t_ds_process_definition drop receivers; |
|
||||||
alter table t_ds_process_definition drop receivers_cc; |
|
||||||
alter table t_ds_process_definition drop modify_by; |
|
||||||
alter table t_ds_process_definition drop resource_ids; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,340 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION public.dolphin_update_metadata( |
|
||||||
) |
|
||||||
RETURNS character varying |
|
||||||
LANGUAGE 'plpgsql' |
|
||||||
COST 100 |
|
||||||
VOLATILE PARALLEL UNSAFE |
|
||||||
AS $BODY$ |
|
||||||
DECLARE |
|
||||||
v_schema varchar; |
|
||||||
BEGIN |
|
||||||
---get schema name |
|
||||||
v_schema =current_schema(); |
|
||||||
|
|
||||||
--- rename columns |
|
||||||
EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_command RENAME COLUMN process_definition_id to process_definition_code'; |
|
||||||
EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_error_command RENAME COLUMN process_definition_id to process_definition_code'; |
|
||||||
EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_process_instance RENAME COLUMN process_definition_id to process_definition_code'; |
|
||||||
EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_task_instance RENAME COLUMN process_definition_id to task_code'; |
|
||||||
EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_schedules RENAME COLUMN process_definition_id to process_definition_code'; |
|
||||||
EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_process_definition RENAME COLUMN project_id to project_code'; |
|
||||||
|
|
||||||
--- alter column type |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_command ALTER COLUMN process_definition_code TYPE bigint'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_error_command ALTER COLUMN process_definition_code TYPE bigint'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ALTER COLUMN process_definition_code TYPE bigint'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ALTER COLUMN task_code TYPE bigint'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_schedules ALTER COLUMN process_definition_code TYPE bigint'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_definition ALTER COLUMN project_code TYPE bigint'; |
|
||||||
|
|
||||||
--- add columns |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_user ADD COLUMN IF NOT EXISTS "state" int DEFAULT 1'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_alertgroup ADD COLUMN IF NOT EXISTS "alert_instance_ids" varchar(255) DEFAULT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_alertgroup ADD COLUMN IF NOT EXISTS "create_user_id" int4 DEFAULT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_project ADD COLUMN IF NOT EXISTS "code" bigint'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_command ADD COLUMN IF NOT EXISTS "environment_code" bigint DEFAULT -1'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_command ADD COLUMN IF NOT EXISTS "dry_run" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_command ADD COLUMN IF NOT EXISTS "process_definition_version" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_command ADD COLUMN IF NOT EXISTS "process_instance_id" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_error_command ADD COLUMN IF NOT EXISTS "environment_code" bigint DEFAULT -1'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_error_command ADD COLUMN IF NOT EXISTS "dry_run" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_error_command ADD COLUMN IF NOT EXISTS "process_definition_version" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_error_command ADD COLUMN IF NOT EXISTS "process_instance_id" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "process_definition_version" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "environment_code" bigint DEFAULT -1'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "var_pool" text'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "dry_run" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "next_process_instance_id" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "task_definition_version" int DEFAULT 1'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "task_params" text'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "environment_code" bigint DEFAULT -1'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "environment_config" text'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "first_submit_time" timestamp DEFAULT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "delay_time" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "var_pool" text'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "dry_run" int DEFAULT 0'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "task_group_id" int DEFAULT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_schedules ADD COLUMN IF NOT EXISTS "timezone_id" varchar(40) DEFAULT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_schedules ADD COLUMN IF NOT EXISTS "environment_code" int DEFAULT -1'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_definition ADD COLUMN IF NOT EXISTS "code" bigint'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_definition ADD COLUMN IF NOT EXISTS "warning_group_id" int'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_definition ADD COLUMN IF NOT EXISTS "execution_type" int DEFAULT 0'; |
|
||||||
|
|
||||||
--update default value for not null |
|
||||||
EXECUTE 'UPDATE ' || quote_ident(v_schema) ||'.t_ds_process_definition SET code = id'; |
|
||||||
EXECUTE 'UPDATE ' || quote_ident(v_schema) ||'.t_ds_project SET code = id'; |
|
||||||
|
|
||||||
---drop columns |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_tenant DROP COLUMN IF EXISTS "tenant_name"'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance DROP COLUMN IF EXISTS "process_instance_json"'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance DROP COLUMN IF EXISTS "locations"'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance DROP COLUMN IF EXISTS "connects"'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance DROP COLUMN IF EXISTS "dependence_schedule_times"'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance DROP COLUMN IF EXISTS "task_json"'; |
|
||||||
|
|
||||||
-- add CONSTRAINT |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_alertgroup" ADD CONSTRAINT "t_ds_alertgroup_name_un" UNIQUE ("group_name")'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_datasource" ADD CONSTRAINT "t_ds_datasource_name_un" UNIQUE ("name","type")'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_command" ALTER COLUMN "process_definition_code" SET NOT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_process_instance" ALTER COLUMN "process_definition_code" SET NOT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_task_instance" ALTER COLUMN "task_code" SET NOT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_schedules" ALTER COLUMN "process_definition_code" SET NOT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_process_definition" ALTER COLUMN "code" SET NOT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_process_definition" ALTER COLUMN "project_code" SET NOT NULL'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_process_definition" ADD CONSTRAINT "process_unique" UNIQUE ("name","project_code")'; |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_project" ALTER COLUMN "code" SET NOT NULL'; |
|
||||||
|
|
||||||
--- drop index |
|
||||||
EXECUTE 'DROP INDEX IF EXISTS "process_instance_index"'; |
|
||||||
EXECUTE 'DROP INDEX IF EXISTS "task_instance_index"'; |
|
||||||
|
|
||||||
--- create index |
|
||||||
EXECUTE 'CREATE INDEX IF NOT EXISTS priority_id_index ON ' || quote_ident(v_schema) ||'.t_ds_command USING Btree("process_instance_priority","id")'; |
|
||||||
EXECUTE 'CREATE INDEX IF NOT EXISTS process_instance_index ON ' || quote_ident(v_schema) ||'.t_ds_process_instance USING Btree("process_definition_code","id")'; |
|
||||||
|
|
||||||
---add comment |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_user.state is ''state 0:disable 1:enable'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_alertgroup.alert_instance_ids is ''alert instance ids'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_alertgroup.create_user_id is ''create user id'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_project.code is ''coding'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_command.process_definition_code is ''process definition code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_command.environment_code is ''environment code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_command.dry_run is ''dry run flag:0 normal, 1 dry run'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_command.process_definition_version is ''process definition version'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_command.process_instance_id is ''process instance id'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_error_command.process_definition_code is ''process definition code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_error_command.environment_code is ''environment code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_error_command.dry_run is ''dry run flag:0 normal, 1 dry run'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_error_command.process_definition_version is ''process definition version'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_error_command.process_instance_id is ''process instance id'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_instance.process_definition_code is ''process instance code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_instance.process_definition_version is ''process instance version'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_instance.environment_code is ''environment code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_instance.var_pool is ''var pool'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_instance.dry_run is ''dry run flag:0 normal, 1 dry run'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.task_code is ''task definition code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.task_definition_version is ''task definition version'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.task_params is ''task params'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.environment_code is ''environment code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.environment_config is ''this config contains many environment variables config'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.first_submit_time is ''task first submit time'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.delay_time is ''task delay execution time'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.var_pool is ''var pool'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.dry_run is ''dry run flag:0 normal, 1 dry run'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_schedules.process_definition_code is ''process definition code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_schedules.timezone_id is ''timezone id'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_schedules.environment_code is ''environment code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_definition.code is ''encoding'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_definition.project_code is ''project code'''; |
|
||||||
EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_definition.warning_group_id is ''alert group id'''; |
|
||||||
|
|
||||||
--create table |
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_plugin_define" ( |
|
||||||
id serial NOT NULL, |
|
||||||
plugin_name varchar(100) NOT NULL, |
|
||||||
plugin_type varchar(100) NOT NULL, |
|
||||||
plugin_params text NULL, |
|
||||||
create_time timestamp NULL, |
|
||||||
update_time timestamp NULL, |
|
||||||
CONSTRAINT t_ds_plugin_define_pk PRIMARY KEY (id), |
|
||||||
CONSTRAINT t_ds_plugin_define_un UNIQUE (plugin_name, plugin_type) |
|
||||||
)'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_alert_plugin_instance" ( |
|
||||||
id serial NOT NULL, |
|
||||||
plugin_define_id int4 NOT NULL, |
|
||||||
plugin_instance_params text NULL, |
|
||||||
create_time timestamp NULL, |
|
||||||
update_time timestamp NULL, |
|
||||||
instance_name varchar(200) NULL, |
|
||||||
CONSTRAINT t_ds_alert_plugin_instance_pk PRIMARY KEY (id) |
|
||||||
)'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_environment" ( |
|
||||||
id serial NOT NULL, |
|
||||||
code bigint NOT NULL, |
|
||||||
name varchar(100) DEFAULT NULL, |
|
||||||
config text DEFAULT NULL, |
|
||||||
description text, |
|
||||||
operator int DEFAULT NULL, |
|
||||||
create_time timestamp DEFAULT NULL, |
|
||||||
update_time timestamp DEFAULT NULL, |
|
||||||
PRIMARY KEY (id), |
|
||||||
CONSTRAINT environment_name_unique UNIQUE (name), |
|
||||||
CONSTRAINT environment_code_unique UNIQUE (code) |
|
||||||
)'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_environment_worker_group_relation" ( |
|
||||||
id serial NOT NULL, |
|
||||||
environment_code bigint NOT NULL, |
|
||||||
worker_group varchar(255) NOT NULL, |
|
||||||
operator int DEFAULT NULL, |
|
||||||
create_time timestamp DEFAULT NULL, |
|
||||||
update_time timestamp DEFAULT NULL, |
|
||||||
PRIMARY KEY (id) , |
|
||||||
CONSTRAINT environment_worker_group_unique UNIQUE (environment_code,worker_group) |
|
||||||
)'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_process_definition_log" ( |
|
||||||
id serial NOT NULL , |
|
||||||
code bigint NOT NULL, |
|
||||||
name varchar(255) DEFAULT NULL , |
|
||||||
version int NOT NULL , |
|
||||||
description text , |
|
||||||
project_code bigint DEFAULT NULL , |
|
||||||
release_state int DEFAULT NULL , |
|
||||||
user_id int DEFAULT NULL , |
|
||||||
global_params text , |
|
||||||
locations text , |
|
||||||
warning_group_id int DEFAULT NULL , |
|
||||||
flag int DEFAULT NULL , |
|
||||||
timeout int DEFAULT 0 , |
|
||||||
tenant_id int DEFAULT -1 , |
|
||||||
execution_type int DEFAULT 0, |
|
||||||
operator int DEFAULT NULL , |
|
||||||
operate_time timestamp DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
)'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_task_definition" ( |
|
||||||
id serial NOT NULL , |
|
||||||
code bigint NOT NULL, |
|
||||||
name varchar(255) DEFAULT NULL , |
|
||||||
version int NOT NULL , |
|
||||||
description text , |
|
||||||
project_code bigint DEFAULT NULL , |
|
||||||
user_id int DEFAULT NULL , |
|
||||||
task_type varchar(50) DEFAULT NULL , |
|
||||||
task_params text , |
|
||||||
flag int DEFAULT NULL , |
|
||||||
task_priority int DEFAULT NULL , |
|
||||||
worker_group varchar(255) DEFAULT NULL , |
|
||||||
environment_code bigint DEFAULT -1, |
|
||||||
fail_retry_times int DEFAULT NULL , |
|
||||||
fail_retry_interval int DEFAULT NULL , |
|
||||||
timeout_flag int DEFAULT NULL , |
|
||||||
timeout_notify_strategy int DEFAULT NULL , |
|
||||||
timeout int DEFAULT 0 , |
|
||||||
delay_time int DEFAULT 0 , |
|
||||||
task_group_id int DEFAULT NULL, |
|
||||||
resource_ids text , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
)'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_task_definition_log" ( |
|
||||||
id serial NOT NULL , |
|
||||||
code bigint NOT NULL, |
|
||||||
name varchar(255) DEFAULT NULL , |
|
||||||
version int NOT NULL , |
|
||||||
description text , |
|
||||||
project_code bigint DEFAULT NULL , |
|
||||||
user_id int DEFAULT NULL , |
|
||||||
task_type varchar(50) DEFAULT NULL , |
|
||||||
task_params text , |
|
||||||
flag int DEFAULT NULL , |
|
||||||
task_priority int DEFAULT NULL , |
|
||||||
worker_group varchar(255) DEFAULT NULL , |
|
||||||
environment_code bigint DEFAULT -1, |
|
||||||
fail_retry_times int DEFAULT NULL , |
|
||||||
fail_retry_interval int DEFAULT NULL , |
|
||||||
timeout_flag int DEFAULT NULL , |
|
||||||
timeout_notify_strategy int DEFAULT NULL , |
|
||||||
timeout int DEFAULT 0 , |
|
||||||
delay_time int DEFAULT 0 , |
|
||||||
task_group_id int DEFAULT NULL, |
|
||||||
resource_ids text , |
|
||||||
operator int DEFAULT NULL , |
|
||||||
operate_time timestamp DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
)'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_process_task_relation" ( |
|
||||||
id serial NOT NULL , |
|
||||||
name varchar(255) DEFAULT NULL , |
|
||||||
project_code bigint DEFAULT NULL , |
|
||||||
process_definition_code bigint DEFAULT NULL , |
|
||||||
process_definition_version int DEFAULT NULL , |
|
||||||
pre_task_code bigint DEFAULT NULL , |
|
||||||
pre_task_version int DEFAULT 0 , |
|
||||||
post_task_code bigint DEFAULT NULL , |
|
||||||
post_task_version int DEFAULT 0 , |
|
||||||
condition_type int DEFAULT NULL , |
|
||||||
condition_params text , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
)'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_process_task_relation_log" ( |
|
||||||
id serial NOT NULL , |
|
||||||
name varchar(255) DEFAULT NULL , |
|
||||||
project_code bigint DEFAULT NULL , |
|
||||||
process_definition_code bigint DEFAULT NULL , |
|
||||||
process_definition_version int DEFAULT NULL , |
|
||||||
pre_task_code bigint DEFAULT NULL , |
|
||||||
pre_task_version int DEFAULT 0 , |
|
||||||
post_task_code bigint DEFAULT NULL , |
|
||||||
post_task_version int DEFAULT 0 , |
|
||||||
condition_type int DEFAULT NULL , |
|
||||||
condition_params text , |
|
||||||
operator int DEFAULT NULL , |
|
||||||
operate_time timestamp DEFAULT NULL , |
|
||||||
create_time timestamp DEFAULT NULL , |
|
||||||
update_time timestamp DEFAULT NULL , |
|
||||||
PRIMARY KEY (id) |
|
||||||
)'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_worker_group" ( |
|
||||||
id serial NOT NULL, |
|
||||||
name varchar(255) NOT NULL, |
|
||||||
addr_list text DEFAULT NULL, |
|
||||||
create_time timestamp DEFAULT NULL, |
|
||||||
update_time timestamp DEFAULT NULL, |
|
||||||
PRIMARY KEY (id), |
|
||||||
CONSTRAINT name_unique UNIQUE (name) |
|
||||||
)'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_audit_log" ( |
|
||||||
id serial NOT NULL, |
|
||||||
user_id int NOT NULL, |
|
||||||
resource_type int NOT NULL, |
|
||||||
operation int NOT NULL, |
|
||||||
time timestamp DEFAULT NULL , |
|
||||||
resource_id int NOT NULL, |
|
||||||
PRIMARY KEY (id) |
|
||||||
)'; |
|
||||||
|
|
||||||
return 'Success!'; |
|
||||||
exception when others then |
|
||||||
---Raise EXCEPTION '(%)',SQLERRM; |
|
||||||
return SQLERRM; |
|
||||||
END; |
|
||||||
$BODY$; |
|
||||||
|
|
||||||
select dolphin_update_metadata(); |
|
||||||
|
|
||||||
d// |
|
@ -1,27 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
ALTER TABLE "t_ds_process_definition" DROP CONSTRAINT "t_ds_process_definition_pkey"; |
|
||||||
ALTER TABLE "t_ds_process_definition" ADD CONSTRAINT "t_ds_process_definition_pkey" PRIMARY KEY ("id","code"); |
|
||||||
ALTER TABLE "t_ds_process_definition" DROP CONSTRAINT "process_definition_unique"; |
|
||||||
DROP INDEX "process_definition_index"; |
|
||||||
ALTER TABLE "t_ds_process_definition" DROP "process_definition_json"; |
|
||||||
ALTER TABLE "t_ds_process_definition" DROP "connects"; |
|
||||||
ALTER TABLE "t_ds_process_definition" DROP "receivers"; |
|
||||||
ALTER TABLE "t_ds_process_definition" DROP "receivers_cc"; |
|
||||||
ALTER TABLE "t_ds_process_definition" DROP "modify_by"; |
|
||||||
ALTER TABLE "t_ds_process_definition" DROP "resource_ids"; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,21 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
|
|
||||||
alter table t_ds_process_instance drop KEY `start_time_index`; |
|
||||||
alter table t_ds_process_instance add KEY `start_time_index` (`start_time`,`end_time`) USING BTREE; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,43 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION public.dolphin_update_metadata( |
|
||||||
) |
|
||||||
RETURNS character varying |
|
||||||
LANGUAGE 'plpgsql' |
|
||||||
COST 100 |
|
||||||
VOLATILE PARALLEL UNSAFE |
|
||||||
AS $BODY$ |
|
||||||
DECLARE |
|
||||||
v_schema varchar; |
|
||||||
BEGIN |
|
||||||
---get schema name |
|
||||||
v_schema =current_schema(); |
|
||||||
|
|
||||||
EXECUTE 'DROP INDEX IF EXISTS "start_time_index"'; |
|
||||||
EXECUTE 'CREATE INDEX IF NOT EXISTS start_time_index ON ' || quote_ident(v_schema) ||'.t_ds_process_instance USING Btree("start_time","end_time")'; |
|
||||||
|
|
||||||
return 'Success!'; |
|
||||||
exception when others then |
|
||||||
---Raise EXCEPTION '(%)',SQLERRM; |
|
||||||
return SQLERRM; |
|
||||||
END; |
|
||||||
$BODY$; |
|
||||||
|
|
||||||
select dolphin_update_metadata(); |
|
||||||
|
|
||||||
d// |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,60 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
|
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_process_instance_A_restart_time |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_instance_A_restart_time; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_process_instance_A_restart_time() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_process_instance' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='restart_time') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_process_instance ADD COLUMN `restart_time` datetime DEFAULT NULL COMMENT 'process instance restart time'; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_process_instance_A_restart_time(); |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_process_instance_A_restart_time; |
|
||||||
|
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_process_task_relation_A_pc_pd_index |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_task_relation_A_pc_pd_index; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_process_task_relation_A_pc_pd_index() |
|
||||||
BEGIN |
|
||||||
IF NOT EXISTS (SELECT 1 FROM information_schema.STATISTICS |
|
||||||
WHERE TABLE_NAME='t_ds_process_task_relation' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND INDEX_NAME ='project_code_process_definition_code_index') |
|
||||||
THEN |
|
||||||
ALTER TABLE `t_ds_process_task_relation` ADD KEY `project_code_process_definition_code_index`(`project_code`,`process_definition_code`) USING BTREE; |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_process_task_relation_A_pc_pd_index(); |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_process_task_relation_A_pc_pd_index; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,44 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION public.dolphin_update_metadata( |
|
||||||
) |
|
||||||
RETURNS character varying |
|
||||||
LANGUAGE 'plpgsql' |
|
||||||
COST 100 |
|
||||||
VOLATILE PARALLEL UNSAFE |
|
||||||
AS $BODY$ |
|
||||||
DECLARE |
|
||||||
v_schema varchar; |
|
||||||
BEGIN |
|
||||||
---get schema name |
|
||||||
v_schema =current_schema(); |
|
||||||
|
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "restart_time" timestamp DEFAULT NULL'; |
|
||||||
|
|
||||||
EXECUTE 'CREATE INDEX IF NOT EXISTS project_code_process_definition_code_index ON ' || quote_ident(v_schema) ||'.t_ds_process_task_relation USING Btree("project_code","process_definition_code")'; |
|
||||||
|
|
||||||
return 'Success!'; |
|
||||||
exception when others then |
|
||||||
---Raise EXCEPTION '(%)',SQLERRM; |
|
||||||
return SQLERRM; |
|
||||||
END; |
|
||||||
$BODY$; |
|
||||||
|
|
||||||
select dolphin_update_metadata(); |
|
||||||
|
|
||||||
d// |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,51 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
drop procedure if exists re_add_index; |
|
||||||
delimiter d// |
|
||||||
create procedure re_add_index(target_table_name varchar(256), |
|
||||||
target_index_type varchar(8), target_index_name varchar(256), |
|
||||||
target_columns varchar(512), using_str varchar(256)) |
|
||||||
begin |
|
||||||
declare target_database varchar(256); |
|
||||||
select database() into target_database; |
|
||||||
IF EXISTS(SELECT * |
|
||||||
FROM information_schema.statistics |
|
||||||
WHERE table_schema = target_database |
|
||||||
AND table_name = target_table_name |
|
||||||
AND index_name = target_index_name) THEN |
|
||||||
set @statement = concat('drop index ', target_index_name, ' on ', target_table_name); |
|
||||||
PREPARE STMT FROM @statement; |
|
||||||
EXECUTE STMT; |
|
||||||
END IF; |
|
||||||
set @statement = |
|
||||||
concat('alter table ', target_table_name, ' add ', target_index_type, ' ', target_index_name, |
|
||||||
'(', target_columns, |
|
||||||
') ', using_str); |
|
||||||
PREPARE STMT FROM @statement; |
|
||||||
EXECUTE STMT; |
|
||||||
end; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
|
|
||||||
ALTER TABLE `t_ds_task_instance` MODIFY COLUMN `task_params` longtext COMMENT 'job custom parameters' AFTER `app_link`; |
|
||||||
|
|
||||||
call re_add_index('t_ds_process_task_relation','KEY','idx_code', '`project_code`, `process_definition_code`', 'USING BTREE'); |
|
||||||
call re_add_index('t_ds_process_task_relation_log','KEY','idx_process_code_version','`process_definition_code`,`process_definition_version`', 'USING BTREE'); |
|
||||||
call re_add_index('t_ds_task_definition_log','INDEX','idx_code_version','`code`,`version`', 'USING BTREE'); |
|
||||||
|
|
||||||
drop procedure if exists re_add_index; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,51 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION public.dolphin_update_metadata( |
|
||||||
) |
|
||||||
RETURNS character varying |
|
||||||
LANGUAGE 'plpgsql' |
|
||||||
COST 100 |
|
||||||
VOLATILE PARALLEL UNSAFE |
|
||||||
AS $BODY$ |
|
||||||
DECLARE |
|
||||||
v_schema varchar; |
|
||||||
BEGIN |
|
||||||
---get schema name |
|
||||||
v_schema =current_schema(); |
|
||||||
|
|
||||||
EXECUTE 'DROP INDEX IF EXISTS "idx_code_relation"'; |
|
||||||
EXECUTE 'DROP INDEX IF EXISTS "idx_process_code_version_relation_log"'; |
|
||||||
EXECUTE 'DROP INDEX IF EXISTS "idx_code_version_task_log"'; |
|
||||||
EXECUTE 'CREATE INDEX IF NOT EXISTS idx_code_relation ON ' || quote_ident(v_schema) ||'.t_ds_process_task_relation USING Btree("project_code","process_definition_code")'; |
|
||||||
EXECUTE 'CREATE INDEX IF NOT EXISTS idx_process_code_version_relation_log ON ' || quote_ident(v_schema) ||'.t_ds_process_task_relation_log USING Btree("process_definition_code","process_definition_version")'; |
|
||||||
EXECUTE 'CREATE INDEX IF NOT EXISTS idx_code_version_task_log ON ' || quote_ident(v_schema) ||'.t_ds_task_definition_log USING Btree("code","version")'; |
|
||||||
|
|
||||||
EXECUTE 'ALTER TABLE t_ds_resources alter COLUMN is_directory TYPE bool using (is_directory::bool)'; |
|
||||||
EXECUTE 'ALTER TABLE t_ds_resources alter COLUMN is_directory SET DEFAULT FALSE'; |
|
||||||
|
|
||||||
return 'Success!'; |
|
||||||
exception when others then |
|
||||||
---Raise EXCEPTION '(%)',SQLERRM; |
|
||||||
return SQLERRM; |
|
||||||
END; |
|
||||||
$BODY$; |
|
||||||
|
|
||||||
select dolphin_update_metadata(); |
|
||||||
|
|
||||||
d// |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,48 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
drop procedure if exists re_add_index; |
|
||||||
delimiter d// |
|
||||||
create procedure re_add_index(target_table_name varchar(256), |
|
||||||
target_index_type varchar(8), target_index_name varchar(256), |
|
||||||
target_columns varchar(512), using_str varchar(256)) |
|
||||||
begin |
|
||||||
declare target_database varchar(256); |
|
||||||
select database() into target_database; |
|
||||||
IF EXISTS(SELECT * |
|
||||||
FROM information_schema.statistics |
|
||||||
WHERE table_schema = target_database |
|
||||||
AND table_name = target_table_name |
|
||||||
AND index_name = target_index_name) THEN |
|
||||||
set @statement = concat('drop index ', target_index_name, ' on ', target_table_name); |
|
||||||
PREPARE STMT FROM @statement; |
|
||||||
EXECUTE STMT; |
|
||||||
END IF; |
|
||||||
set @statement = |
|
||||||
concat('alter table ', target_table_name, ' add ', target_index_type, ' ', target_index_name, |
|
||||||
'(', target_columns, |
|
||||||
') ', using_str); |
|
||||||
PREPARE STMT FROM @statement; |
|
||||||
EXECUTE STMT; |
|
||||||
end; |
|
||||||
d// |
|
||||||
delimiter ; |
|
||||||
|
|
||||||
call re_add_index('t_ds_task_instance','INDEX','idx_code_version','`task_code`, `task_definition_version`', 'USING BTREE'); |
|
||||||
call re_add_index('t_ds_task_definition_log','INDEX','idx_project_code','`project_code`', 'USING BTREE'); |
|
||||||
|
|
||||||
drop procedure if exists re_add_index; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,47 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION public.dolphin_update_metadata( |
|
||||||
) |
|
||||||
RETURNS character varying |
|
||||||
LANGUAGE 'plpgsql' |
|
||||||
COST 100 |
|
||||||
VOLATILE PARALLEL UNSAFE |
|
||||||
AS $BODY$ |
|
||||||
DECLARE |
|
||||||
v_schema varchar; |
|
||||||
BEGIN |
|
||||||
---get schema name |
|
||||||
v_schema =current_schema(); |
|
||||||
|
|
||||||
EXECUTE 'DROP INDEX IF EXISTS "idx_task_definition_log_project_code"'; |
|
||||||
EXECUTE 'CREATE INDEX IF NOT EXISTS idx_task_definition_log_project_code ON ' || quote_ident(v_schema) ||'.t_ds_task_definition_log USING Btree("project_code")'; |
|
||||||
|
|
||||||
EXECUTE 'DROP INDEX IF EXISTS "idx_task_instance_code_version"'; |
|
||||||
EXECUTE 'CREATE INDEX IF NOT EXISTS idx_task_instance_code_version ON' || quote_ident(v_schema) ||'.t_ds_task_instance USING Btree("task_code","task_definition_version")'; |
|
||||||
|
|
||||||
return 'Success!'; |
|
||||||
exception when others then |
|
||||||
---Raise EXCEPTION '(%)',SQLERRM; |
|
||||||
return SQLERRM; |
|
||||||
END; |
|
||||||
$BODY$; |
|
||||||
|
|
||||||
select dolphin_update_metadata(); |
|
||||||
|
|
||||||
d// |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,38 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
|
||||||
|
|
||||||
-- uc_dolphin_T_t_ds_resources_R_full_name |
|
||||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_resources_R_full_name; |
|
||||||
delimiter d// |
|
||||||
CREATE PROCEDURE uc_dolphin_T_t_ds_resources_R_full_name() |
|
||||||
BEGIN |
|
||||||
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
||||||
WHERE TABLE_NAME='t_ds_resources' |
|
||||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
|
||||||
AND COLUMN_NAME ='full_name') |
|
||||||
THEN |
|
||||||
ALTER TABLE t_ds_resources MODIFY COLUMN `full_name` varchar(128); |
|
||||||
END IF; |
|
||||||
END; |
|
||||||
|
|
||||||
d// |
|
||||||
|
|
||||||
delimiter ; |
|
||||||
CALL uc_dolphin_T_t_ds_resources_R_full_name; |
|
||||||
DROP PROCEDURE uc_dolphin_T_t_ds_resources_R_full_name; |
|
@ -1,16 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
@ -1,44 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
delimiter d// |
|
||||||
CREATE OR REPLACE FUNCTION public.dolphin_update_metadata( |
|
||||||
) |
|
||||||
RETURNS character varying |
|
||||||
LANGUAGE 'plpgsql' |
|
||||||
COST 100 |
|
||||||
VOLATILE PARALLEL UNSAFE |
|
||||||
AS $BODY$ |
|
||||||
DECLARE |
|
||||||
v_schema varchar; |
|
||||||
BEGIN |
|
||||||
---get schema name |
|
||||||
v_schema =current_schema(); |
|
||||||
|
|
||||||
--- alter column |
|
||||||
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_resources ALTER COLUMN full_name Type varchar(128)'; |
|
||||||
|
|
||||||
return 'Success!'; |
|
||||||
exception when others then |
|
||||||
---Raise EXCEPTION '(%)',SQLERRM; |
|
||||||
return SQLERRM; |
|
||||||
END; |
|
||||||
$BODY$; |
|
||||||
|
|
||||||
select dolphin_update_metadata(); |
|
||||||
|
|
||||||
d// |
|
@ -1,17 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
@ -1,247 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package org.apache.dolphinscheduler.tools.datasource.dao; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; |
|
||||||
import org.apache.dolphinscheduler.dao.entity.WorkflowDefinitionLog; |
|
||||||
import org.apache.dolphinscheduler.dao.entity.WorkflowTaskRelationLog; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.Date; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
@Deprecated |
|
||||||
@Slf4j |
|
||||||
public class JsonSplitDao { |
|
||||||
|
|
||||||
/** |
|
||||||
* executeJsonSplitProcessDefinition |
|
||||||
* |
|
||||||
* @param conn jdbc connection |
|
||||||
* @param processDefinitionLogs processDefinitionLogs |
|
||||||
*/ |
|
||||||
public void executeJsonSplitProcessDefinition(Connection conn, List<WorkflowDefinitionLog> processDefinitionLogs) { |
|
||||||
String updateSql = |
|
||||||
"UPDATE t_ds_process_definition SET global_params=?,timeout=?,locations=?,update_time=? where id=?"; |
|
||||||
String insertLogSql = |
|
||||||
"insert into t_ds_process_definition_log (code,name,version,description,project_code,release_state,user_id," |
|
||||||
+ "global_params,flag,locations,timeout,operator,operate_time,create_time,update_time) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; |
|
||||||
try { |
|
||||||
PreparedStatement processUpdate = conn.prepareStatement(updateSql); |
|
||||||
PreparedStatement insertLog = conn.prepareStatement(insertLogSql); |
|
||||||
int i = 0; |
|
||||||
for (WorkflowDefinitionLog processDefinitionLog : processDefinitionLogs) { |
|
||||||
processUpdate.setString(1, processDefinitionLog.getGlobalParams()); |
|
||||||
processUpdate.setInt(2, processDefinitionLog.getTimeout()); |
|
||||||
processUpdate.setString(3, processDefinitionLog.getLocations()); |
|
||||||
processUpdate.setDate(4, new Date(processDefinitionLog.getUpdateTime().getTime())); |
|
||||||
processUpdate.setInt(5, processDefinitionLog.getId()); |
|
||||||
processUpdate.addBatch(); |
|
||||||
|
|
||||||
insertLog.setLong(1, processDefinitionLog.getCode()); |
|
||||||
insertLog.setString(2, processDefinitionLog.getName()); |
|
||||||
insertLog.setInt(3, processDefinitionLog.getVersion()); |
|
||||||
insertLog.setString(4, processDefinitionLog.getDescription()); |
|
||||||
insertLog.setLong(5, processDefinitionLog.getProjectCode()); |
|
||||||
insertLog.setInt(6, processDefinitionLog.getReleaseState().getCode()); |
|
||||||
insertLog.setInt(7, processDefinitionLog.getUserId()); |
|
||||||
insertLog.setString(8, processDefinitionLog.getGlobalParams()); |
|
||||||
insertLog.setInt(9, processDefinitionLog.getFlag().getCode()); |
|
||||||
insertLog.setString(10, processDefinitionLog.getLocations()); |
|
||||||
insertLog.setInt(11, processDefinitionLog.getTimeout()); |
|
||||||
insertLog.setInt(12, processDefinitionLog.getOperator()); |
|
||||||
insertLog.setDate(13, new Date(processDefinitionLog.getOperateTime().getTime())); |
|
||||||
insertLog.setDate(14, new Date(processDefinitionLog.getCreateTime().getTime())); |
|
||||||
insertLog.setDate(15, new Date(processDefinitionLog.getUpdateTime().getTime())); |
|
||||||
insertLog.addBatch(); |
|
||||||
|
|
||||||
i++; |
|
||||||
if (i % 1000 == 0) { |
|
||||||
processUpdate.executeBatch(); |
|
||||||
processUpdate.clearBatch(); |
|
||||||
insertLog.executeBatch(); |
|
||||||
insertLog.clearBatch(); |
|
||||||
} |
|
||||||
} |
|
||||||
processUpdate.executeBatch(); |
|
||||||
insertLog.executeBatch(); |
|
||||||
processUpdate.close(); |
|
||||||
insertLog.close(); |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* executeJsonSplitProcessDefinition |
|
||||||
* |
|
||||||
* @param conn jdbc connection |
|
||||||
* @param processTaskRelationLogs processTaskRelationLogs |
|
||||||
*/ |
|
||||||
public void executeJsonSplitProcessTaskRelation(Connection conn, |
|
||||||
List<WorkflowTaskRelationLog> processTaskRelationLogs) { |
|
||||||
String insertSql = |
|
||||||
"insert into t_ds_process_task_relation (project_code,process_definition_code,process_definition_version,pre_task_code,pre_task_version," |
|
||||||
+ "post_task_code,post_task_version,condition_type,condition_params,create_time,update_time) values (?,?,?,?,?,?,?,?,?,?,?)"; |
|
||||||
String insertLogSql = |
|
||||||
"insert into t_ds_process_task_relation_log (project_code,process_definition_code,process_definition_version,pre_task_code," |
|
||||||
+ "pre_task_version,post_task_code,post_task_version,condition_type,condition_params,operator,operate_time,create_time,update_time) " |
|
||||||
+ "values (?,?,?,?,?,?,?,?,?,?,?,?,?)"; |
|
||||||
try { |
|
||||||
PreparedStatement insert = conn.prepareStatement(insertSql); |
|
||||||
PreparedStatement insertLog = conn.prepareStatement(insertLogSql); |
|
||||||
int i = 0; |
|
||||||
for (WorkflowTaskRelationLog processTaskRelationLog : processTaskRelationLogs) { |
|
||||||
insert.setLong(1, processTaskRelationLog.getProjectCode()); |
|
||||||
insert.setLong(2, processTaskRelationLog.getProcessDefinitionCode()); |
|
||||||
insert.setInt(3, processTaskRelationLog.getProcessDefinitionVersion()); |
|
||||||
insert.setLong(4, processTaskRelationLog.getPreTaskCode()); |
|
||||||
insert.setInt(5, processTaskRelationLog.getPreTaskVersion()); |
|
||||||
insert.setLong(6, processTaskRelationLog.getPostTaskCode()); |
|
||||||
insert.setInt(7, processTaskRelationLog.getPostTaskVersion()); |
|
||||||
insert.setInt(8, processTaskRelationLog.getConditionType().getCode()); |
|
||||||
insert.setString(9, processTaskRelationLog.getConditionParams()); |
|
||||||
insert.setDate(10, new Date(processTaskRelationLog.getCreateTime().getTime())); |
|
||||||
insert.setDate(11, new Date(processTaskRelationLog.getUpdateTime().getTime())); |
|
||||||
insert.addBatch(); |
|
||||||
|
|
||||||
insertLog.setLong(1, processTaskRelationLog.getProjectCode()); |
|
||||||
insertLog.setLong(2, processTaskRelationLog.getProcessDefinitionCode()); |
|
||||||
insertLog.setInt(3, processTaskRelationLog.getProcessDefinitionVersion()); |
|
||||||
insertLog.setLong(4, processTaskRelationLog.getPreTaskCode()); |
|
||||||
insertLog.setInt(5, processTaskRelationLog.getPreTaskVersion()); |
|
||||||
insertLog.setLong(6, processTaskRelationLog.getPostTaskCode()); |
|
||||||
insertLog.setInt(7, processTaskRelationLog.getPostTaskVersion()); |
|
||||||
insertLog.setInt(8, processTaskRelationLog.getConditionType().getCode()); |
|
||||||
insertLog.setString(9, processTaskRelationLog.getConditionParams()); |
|
||||||
insertLog.setInt(10, processTaskRelationLog.getOperator()); |
|
||||||
insertLog.setDate(11, new Date(processTaskRelationLog.getOperateTime().getTime())); |
|
||||||
insertLog.setDate(12, new Date(processTaskRelationLog.getCreateTime().getTime())); |
|
||||||
insertLog.setDate(13, new Date(processTaskRelationLog.getUpdateTime().getTime())); |
|
||||||
insertLog.addBatch(); |
|
||||||
|
|
||||||
i++; |
|
||||||
if (i % 1000 == 0) { |
|
||||||
insert.executeBatch(); |
|
||||||
insert.clearBatch(); |
|
||||||
insertLog.executeBatch(); |
|
||||||
insertLog.clearBatch(); |
|
||||||
} |
|
||||||
} |
|
||||||
insert.executeBatch(); |
|
||||||
insertLog.executeBatch(); |
|
||||||
insert.close(); |
|
||||||
insertLog.close(); |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* executeJsonSplitTaskDefinition |
|
||||||
* |
|
||||||
* @param conn jdbc connection |
|
||||||
* @param taskDefinitionLogs taskDefinitionLogs |
|
||||||
*/ |
|
||||||
public void executeJsonSplitTaskDefinition(Connection conn, List<TaskDefinitionLog> taskDefinitionLogs) { |
|
||||||
String insertSql = |
|
||||||
"insert into t_ds_task_definition (code,name,version,description,project_code,user_id,task_type,task_params,flag,task_priority," |
|
||||||
+ "worker_group,environment_code,fail_retry_times,fail_retry_interval,timeout_flag,timeout_notify_strategy,timeout,delay_time,resource_ids," |
|
||||||
+ "create_time,update_time) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; |
|
||||||
String insertLogSql = |
|
||||||
"insert into t_ds_task_definition_log (code,name,version,description,project_code,user_id,task_type,task_params,flag,task_priority," |
|
||||||
+ "worker_group,environment_code,fail_retry_times,fail_retry_interval,timeout_flag,timeout_notify_strategy,timeout,delay_time,resource_ids,operator," |
|
||||||
+ "operate_time,create_time,update_time) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; |
|
||||||
try { |
|
||||||
PreparedStatement insert = conn.prepareStatement(insertSql); |
|
||||||
PreparedStatement insertLog = conn.prepareStatement(insertLogSql); |
|
||||||
int i = 0; |
|
||||||
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { |
|
||||||
insert.setLong(1, taskDefinitionLog.getCode()); |
|
||||||
insert.setString(2, taskDefinitionLog.getName()); |
|
||||||
insert.setInt(3, taskDefinitionLog.getVersion()); |
|
||||||
insert.setString(4, taskDefinitionLog.getDescription()); |
|
||||||
insert.setLong(5, taskDefinitionLog.getProjectCode()); |
|
||||||
insert.setInt(6, taskDefinitionLog.getUserId()); |
|
||||||
insert.setString(7, taskDefinitionLog.getTaskType()); |
|
||||||
insert.setString(8, taskDefinitionLog.getTaskParams()); |
|
||||||
insert.setInt(9, taskDefinitionLog.getFlag().getCode()); |
|
||||||
insert.setInt(10, taskDefinitionLog.getTaskPriority().getCode()); |
|
||||||
insert.setString(11, taskDefinitionLog.getWorkerGroup()); |
|
||||||
insert.setLong(12, taskDefinitionLog.getEnvironmentCode()); |
|
||||||
insert.setInt(13, taskDefinitionLog.getFailRetryTimes()); |
|
||||||
insert.setInt(14, taskDefinitionLog.getFailRetryInterval()); |
|
||||||
insert.setInt(15, taskDefinitionLog.getTimeoutFlag().getCode()); |
|
||||||
insert.setInt(16, taskDefinitionLog.getTimeoutNotifyStrategy() == null ? 0 |
|
||||||
: taskDefinitionLog.getTimeoutNotifyStrategy().getCode()); |
|
||||||
insert.setInt(17, taskDefinitionLog.getTimeout()); |
|
||||||
insert.setInt(18, taskDefinitionLog.getDelayTime()); |
|
||||||
insert.setString(19, taskDefinitionLog.getResourceIds()); |
|
||||||
insert.setDate(20, new Date(taskDefinitionLog.getCreateTime().getTime())); |
|
||||||
insert.setDate(21, new Date(taskDefinitionLog.getUpdateTime().getTime())); |
|
||||||
insert.addBatch(); |
|
||||||
|
|
||||||
insertLog.setLong(1, taskDefinitionLog.getCode()); |
|
||||||
insertLog.setString(2, taskDefinitionLog.getName()); |
|
||||||
insertLog.setInt(3, taskDefinitionLog.getVersion()); |
|
||||||
insertLog.setString(4, taskDefinitionLog.getDescription()); |
|
||||||
insertLog.setLong(5, taskDefinitionLog.getProjectCode()); |
|
||||||
insertLog.setInt(6, taskDefinitionLog.getUserId()); |
|
||||||
insertLog.setString(7, taskDefinitionLog.getTaskType()); |
|
||||||
insertLog.setString(8, taskDefinitionLog.getTaskParams()); |
|
||||||
insertLog.setInt(9, taskDefinitionLog.getFlag().getCode()); |
|
||||||
insertLog.setInt(10, taskDefinitionLog.getTaskPriority().getCode()); |
|
||||||
insertLog.setString(11, taskDefinitionLog.getWorkerGroup()); |
|
||||||
insertLog.setLong(12, taskDefinitionLog.getEnvironmentCode()); |
|
||||||
insertLog.setInt(13, taskDefinitionLog.getFailRetryTimes()); |
|
||||||
insertLog.setInt(14, taskDefinitionLog.getFailRetryInterval()); |
|
||||||
insertLog.setInt(15, taskDefinitionLog.getTimeoutFlag().getCode()); |
|
||||||
insertLog.setInt(16, taskDefinitionLog.getTimeoutNotifyStrategy() == null ? 0 |
|
||||||
: taskDefinitionLog.getTimeoutNotifyStrategy().getCode()); |
|
||||||
insertLog.setInt(17, taskDefinitionLog.getTimeout()); |
|
||||||
insertLog.setInt(18, taskDefinitionLog.getDelayTime()); |
|
||||||
insertLog.setString(19, taskDefinitionLog.getResourceIds()); |
|
||||||
insertLog.setInt(20, taskDefinitionLog.getOperator()); |
|
||||||
insertLog.setDate(21, new Date(taskDefinitionLog.getOperateTime().getTime())); |
|
||||||
insertLog.setDate(22, new Date(taskDefinitionLog.getCreateTime().getTime())); |
|
||||||
insertLog.setDate(23, new Date(taskDefinitionLog.getUpdateTime().getTime())); |
|
||||||
insertLog.addBatch(); |
|
||||||
|
|
||||||
i++; |
|
||||||
if (i % 1000 == 0) { |
|
||||||
insert.executeBatch(); |
|
||||||
insert.clearBatch(); |
|
||||||
insertLog.executeBatch(); |
|
||||||
insertLog.clearBatch(); |
|
||||||
} |
|
||||||
} |
|
||||||
insert.executeBatch(); |
|
||||||
insertLog.executeBatch(); |
|
||||||
insert.close(); |
|
||||||
insertLog.close(); |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,157 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package org.apache.dolphinscheduler.tools.datasource.dao; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.common.constants.Constants; |
|
||||||
import org.apache.dolphinscheduler.common.enums.Flag; |
|
||||||
import org.apache.dolphinscheduler.common.enums.ReleaseState; |
|
||||||
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; |
|
||||||
import org.apache.dolphinscheduler.dao.entity.WorkflowDefinition; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.List; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
@Deprecated |
|
||||||
@Slf4j |
|
||||||
public class ProcessDefinitionDao { |
|
||||||
|
|
||||||
/** |
|
||||||
* queryAllProcessDefinition |
|
||||||
* |
|
||||||
* @param conn jdbc connection |
|
||||||
* @return ProcessDefinition Json List |
|
||||||
*/ |
|
||||||
public Map<Integer, String> queryAllProcessDefinition(Connection conn) { |
|
||||||
|
|
||||||
Map<Integer, String> processDefinitionJsonMap = new HashMap<>(); |
|
||||||
|
|
||||||
String sql = "SELECT id,process_definition_json FROM t_ds_process_definition"; |
|
||||||
try ( |
|
||||||
PreparedStatement pstmt = conn.prepareStatement(sql); |
|
||||||
ResultSet rs = pstmt.executeQuery()) { |
|
||||||
|
|
||||||
while (rs.next()) { |
|
||||||
Integer id = rs.getInt(1); |
|
||||||
String processDefinitionJson = rs.getString(2); |
|
||||||
processDefinitionJsonMap.put(id, processDefinitionJson); |
|
||||||
} |
|
||||||
|
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
|
|
||||||
return processDefinitionJsonMap; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* updateProcessDefinitionJson |
|
||||||
* |
|
||||||
* @param conn jdbc connection |
|
||||||
* @param processDefinitionJsonMap processDefinitionJsonMap |
|
||||||
*/ |
|
||||||
public void updateProcessDefinitionJson(Connection conn, Map<Integer, String> processDefinitionJsonMap) { |
|
||||||
String sql = "UPDATE t_ds_process_definition SET process_definition_json=? where id=?"; |
|
||||||
try { |
|
||||||
for (Map.Entry<Integer, String> entry : processDefinitionJsonMap.entrySet()) { |
|
||||||
try (PreparedStatement pstmt = conn.prepareStatement(sql)) { |
|
||||||
pstmt.setString(1, entry.getValue()); |
|
||||||
pstmt.setInt(2, entry.getKey()); |
|
||||||
pstmt.executeUpdate(); |
|
||||||
} |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public List<WorkflowDefinition> queryProcessDefinition(Connection conn) { |
|
||||||
List<WorkflowDefinition> workflowDefinitions = new ArrayList<>(); |
|
||||||
String sql = |
|
||||||
"SELECT id,code,project_code,user_id,locations,name,description,release_state,flag,create_time FROM t_ds_process_definition"; |
|
||||||
try ( |
|
||||||
PreparedStatement pstmt = conn.prepareStatement(sql); |
|
||||||
ResultSet rs = pstmt.executeQuery()) { |
|
||||||
while (rs.next()) { |
|
||||||
WorkflowDefinition workflowDefinition = new WorkflowDefinition(); |
|
||||||
workflowDefinition.setId(rs.getInt(1)); |
|
||||||
long code = rs.getLong(2); |
|
||||||
if (code == 0L) { |
|
||||||
code = CodeGenerateUtils.genCode(); |
|
||||||
} |
|
||||||
workflowDefinition.setCode(code); |
|
||||||
workflowDefinition.setVersion(Constants.VERSION_FIRST); |
|
||||||
workflowDefinition.setProjectCode(rs.getLong(3)); |
|
||||||
workflowDefinition.setUserId(rs.getInt(4)); |
|
||||||
workflowDefinition.setLocations(rs.getString(5)); |
|
||||||
workflowDefinition.setName(rs.getString(6)); |
|
||||||
workflowDefinition.setDescription(rs.getString(7)); |
|
||||||
workflowDefinition.setReleaseState(ReleaseState.getEnum(rs.getInt(8))); |
|
||||||
workflowDefinition.setFlag(rs.getInt(9) == 1 ? Flag.YES : Flag.NO); |
|
||||||
workflowDefinition.setCreateTime(rs.getDate(10)); |
|
||||||
workflowDefinitions.add(workflowDefinition); |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
return workflowDefinitions; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* updateProcessDefinitionCode |
|
||||||
* |
|
||||||
* @param conn jdbc connection |
|
||||||
* @param workflowDefinitions processDefinitions |
|
||||||
* @param projectIdCodeMap projectIdCodeMap |
|
||||||
*/ |
|
||||||
public void updateProcessDefinitionCode(Connection conn, List<WorkflowDefinition> workflowDefinitions, |
|
||||||
Map<Integer, Long> projectIdCodeMap) { |
|
||||||
String sql = "UPDATE t_ds_process_definition SET code=?, project_code=?, version=? where id=?"; |
|
||||||
try { |
|
||||||
for (WorkflowDefinition workflowDefinition : workflowDefinitions) { |
|
||||||
try (PreparedStatement pstmt = conn.prepareStatement(sql)) { |
|
||||||
pstmt.setLong(1, workflowDefinition.getCode()); |
|
||||||
long projectCode = workflowDefinition.getProjectCode(); |
|
||||||
if (String.valueOf(projectCode).length() <= 10) { |
|
||||||
Integer projectId = Integer.parseInt(String.valueOf(projectCode)); |
|
||||||
if (projectIdCodeMap.containsKey(projectId)) { |
|
||||||
projectCode = projectIdCodeMap.get(projectId); |
|
||||||
workflowDefinition.setProjectCode(projectCode); |
|
||||||
} |
|
||||||
} |
|
||||||
pstmt.setLong(2, projectCode); |
|
||||||
pstmt.setInt(3, workflowDefinition.getVersion()); |
|
||||||
pstmt.setInt(4, workflowDefinition.getId()); |
|
||||||
pstmt.executeUpdate(); |
|
||||||
} |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,82 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package org.apache.dolphinscheduler.tools.datasource.dao; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
@Deprecated |
|
||||||
@Slf4j |
|
||||||
public class ProjectDao { |
|
||||||
|
|
||||||
/** |
|
||||||
* queryAllProject |
|
||||||
* |
|
||||||
* @param conn jdbc connection |
|
||||||
* @return Project List |
|
||||||
*/ |
|
||||||
public Map<Integer, Long> queryAllProject(Connection conn) { |
|
||||||
Map<Integer, Long> projectMap = new HashMap<>(); |
|
||||||
String sql = "SELECT id,code FROM t_ds_project"; |
|
||||||
try ( |
|
||||||
PreparedStatement pstmt = conn.prepareStatement(sql); |
|
||||||
ResultSet rs = pstmt.executeQuery()) { |
|
||||||
while (rs.next()) { |
|
||||||
Integer id = rs.getInt(1); |
|
||||||
long code = rs.getLong(2); |
|
||||||
if (code == 0L) { |
|
||||||
code = CodeGenerateUtils.genCode(); |
|
||||||
} |
|
||||||
projectMap.put(id, code); |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
return projectMap; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* updateProjectCode |
|
||||||
* |
|
||||||
* @param conn jdbc connection |
|
||||||
* @param projectMap projectMap |
|
||||||
*/ |
|
||||||
public void updateProjectCode(Connection conn, Map<Integer, Long> projectMap) { |
|
||||||
String sql = "UPDATE t_ds_project SET code=? where id=?"; |
|
||||||
try { |
|
||||||
for (Map.Entry<Integer, Long> entry : projectMap.entrySet()) { |
|
||||||
try (PreparedStatement pstmt = conn.prepareStatement(sql)) { |
|
||||||
pstmt.setLong(1, entry.getValue()); |
|
||||||
pstmt.setInt(2, entry.getKey()); |
|
||||||
pstmt.executeUpdate(); |
|
||||||
} |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,102 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package org.apache.dolphinscheduler.tools.datasource.dao; |
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.util.Arrays; |
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
import com.google.common.base.Joiner; |
|
||||||
import com.google.common.base.Strings; |
|
||||||
|
|
||||||
/** |
|
||||||
* resource dao |
|
||||||
*/ |
|
||||||
@Deprecated |
|
||||||
@Slf4j |
|
||||||
public class ResourceDao { |
|
||||||
|
|
||||||
/** |
|
||||||
* list all resources by the type |
|
||||||
* |
|
||||||
* @param conn connection |
|
||||||
* @return map that key is full_name and value is the folder's size |
|
||||||
*/ |
|
||||||
private Map<String, Long> listAllResourcesByFileType(Connection conn, int type) { |
|
||||||
Map<String, Long> resourceSizeMap = new HashMap<>(); |
|
||||||
|
|
||||||
String sql = |
|
||||||
String.format("SELECT full_name, type, size, is_directory FROM t_ds_resources where type = %d", type); |
|
||||||
try ( |
|
||||||
PreparedStatement pstmt = conn.prepareStatement(sql); |
|
||||||
ResultSet rs = pstmt.executeQuery()) { |
|
||||||
|
|
||||||
while (rs.next()) { |
|
||||||
String fullName = rs.getString("full_name"); |
|
||||||
boolean isDirectory = rs.getBoolean("is_directory"); |
|
||||||
long fileSize = rs.getLong("size"); |
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(fullName) && !isDirectory) { |
|
||||||
String[] splits = fullName.split("/"); |
|
||||||
for (int i = 1; i < splits.length; i++) { |
|
||||||
String parentFullName = Joiner.on("/").join(Arrays.copyOfRange(splits, 0, splits.length - i)); |
|
||||||
if (!Strings.isNullOrEmpty(parentFullName)) { |
|
||||||
long size = resourceSizeMap.getOrDefault(parentFullName, 0L); |
|
||||||
resourceSizeMap.put(parentFullName, size + fileSize); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
return resourceSizeMap; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* update the folder's size |
|
||||||
* |
|
||||||
* @param conn connection |
|
||||||
*/ |
|
||||||
public void updateResourceFolderSizeByFileType(Connection conn, int type) { |
|
||||||
Map<String, Long> resourceSizeMap = listAllResourcesByFileType(conn, type); |
|
||||||
|
|
||||||
String sql = "UPDATE t_ds_resources SET size=? where type=? and full_name=? and is_directory = true"; |
|
||||||
try (PreparedStatement pstmt = conn.prepareStatement(sql)) { |
|
||||||
for (Map.Entry<String, Long> entry : resourceSizeMap.entrySet()) { |
|
||||||
pstmt.setLong(1, entry.getValue()); |
|
||||||
pstmt.setInt(2, type); |
|
||||||
pstmt.setString(3, entry.getKey()); |
|
||||||
pstmt.addBatch(); |
|
||||||
} |
|
||||||
pstmt.executeBatch(); |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,90 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package org.apache.dolphinscheduler.tools.datasource.dao; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.time.Clock; |
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
@Deprecated |
|
||||||
@Slf4j |
|
||||||
public class ScheduleDao { |
|
||||||
|
|
||||||
/** |
|
||||||
* queryAllSchedule |
|
||||||
* |
|
||||||
* @param conn jdbc connection |
|
||||||
* @return Schedule List |
|
||||||
*/ |
|
||||||
public Map<Integer, Long> queryAllSchedule(Connection conn) { |
|
||||||
Map<Integer, Long> scheduleMap = new HashMap<>(); |
|
||||||
String sql = "SELECT id,process_definition_code FROM t_ds_schedules"; |
|
||||||
try ( |
|
||||||
PreparedStatement pstmt = conn.prepareStatement(sql); |
|
||||||
ResultSet rs = pstmt.executeQuery()) { |
|
||||||
while (rs.next()) { |
|
||||||
Integer id = rs.getInt(1); |
|
||||||
long processDefinitionCode = rs.getLong(2); |
|
||||||
scheduleMap.put(id, processDefinitionCode); |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
return scheduleMap; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* update schedule |
|
||||||
* |
|
||||||
* @param conn jdbc connection |
|
||||||
* @param scheduleMap scheduleMap |
|
||||||
* @param processIdCodeMap processIdCodeMap |
|
||||||
*/ |
|
||||||
public void updateScheduleCode(Connection conn, Map<Integer, Long> scheduleMap, |
|
||||||
Map<Integer, Long> processIdCodeMap) { |
|
||||||
String sql = "UPDATE t_ds_schedules SET process_definition_code=?,timezone_id=?,environment_code=-1 where id=?"; |
|
||||||
try { |
|
||||||
Clock clock = Clock.systemDefaultZone(); |
|
||||||
String timezoneId = clock.getZone().getId(); |
|
||||||
for (Map.Entry<Integer, Long> entry : scheduleMap.entrySet()) { |
|
||||||
try (PreparedStatement pstmt = conn.prepareStatement(sql)) { |
|
||||||
long projectDefinitionCode = entry.getValue(); |
|
||||||
if (String.valueOf(projectDefinitionCode).length() <= 10) { |
|
||||||
Integer projectDefinitionId = Integer.parseInt(String.valueOf(projectDefinitionCode)); |
|
||||||
if (processIdCodeMap.containsKey(projectDefinitionId)) { |
|
||||||
projectDefinitionCode = processIdCodeMap.get(projectDefinitionId); |
|
||||||
} |
|
||||||
} |
|
||||||
pstmt.setLong(1, projectDefinitionCode); |
|
||||||
pstmt.setString(2, timezoneId); |
|
||||||
pstmt.setInt(3, entry.getKey()); |
|
||||||
pstmt.executeUpdate(); |
|
||||||
} |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,58 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package org.apache.dolphinscheduler.tools.datasource.dao; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
@Deprecated |
|
||||||
@Slf4j |
|
||||||
public class WorkerGroupDao { |
|
||||||
|
|
||||||
/** |
|
||||||
* query all old worker group |
|
||||||
* @param conn jdbc connection |
|
||||||
* @return old worker group Map |
|
||||||
*/ |
|
||||||
public Map<Integer, String> queryAllOldWorkerGroup(Connection conn) { |
|
||||||
Map<Integer, String> workerGroupMap = new HashMap<>(); |
|
||||||
|
|
||||||
String sql = "select id,name from t_ds_worker_group"; |
|
||||||
try ( |
|
||||||
PreparedStatement pstmt = conn.prepareStatement(sql); |
|
||||||
ResultSet rs = pstmt.executeQuery()) { |
|
||||||
|
|
||||||
while (rs.next()) { |
|
||||||
int id = rs.getInt(1); |
|
||||||
String name = rs.getString(2); |
|
||||||
workerGroupMap.put(id, name); |
|
||||||
} |
|
||||||
|
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
|
|
||||||
return workerGroupMap; |
|
||||||
} |
|
||||||
} |
|
@ -1,97 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package org.apache.dolphinscheduler.tools.datasource.upgrader.v130; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.dao.ProcessDefinitionDao; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.dao.WorkerGroupDao; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.upgrader.DolphinSchedulerUpgrader; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.upgrader.DolphinSchedulerVersion; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
import javax.sql.DataSource; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.stereotype.Component; |
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.node.ArrayNode; |
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
||||||
|
|
||||||
@Slf4j |
|
||||||
@Component |
|
||||||
public class V130DolphinSchedulerUpgrader implements DolphinSchedulerUpgrader { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private DataSource dataSource; |
|
||||||
|
|
||||||
@Override |
|
||||||
public void doUpgrade() { |
|
||||||
updateProcessDefinitionJsonWorkerGroup(); |
|
||||||
} |
|
||||||
|
|
||||||
private void updateProcessDefinitionJsonWorkerGroup() { |
|
||||||
WorkerGroupDao workerGroupDao = new WorkerGroupDao(); |
|
||||||
ProcessDefinitionDao processDefinitionDao = new ProcessDefinitionDao(); |
|
||||||
Map<Integer, String> replaceProcessDefinitionMap = new HashMap<>(); |
|
||||||
try (Connection connection = dataSource.getConnection()) { |
|
||||||
Map<Integer, String> oldWorkerGroupMap = workerGroupDao.queryAllOldWorkerGroup(connection); |
|
||||||
Map<Integer, String> processDefinitionJsonMap = |
|
||||||
processDefinitionDao.queryAllProcessDefinition(connection); |
|
||||||
|
|
||||||
for (Map.Entry<Integer, String> entry : processDefinitionJsonMap.entrySet()) { |
|
||||||
ObjectNode jsonObject = JSONUtils.parseObject(entry.getValue()); |
|
||||||
ArrayNode tasks = JSONUtils.parseArray(jsonObject.get("tasks").toString()); |
|
||||||
|
|
||||||
for (int i = 0; i < tasks.size(); i++) { |
|
||||||
ObjectNode task = (ObjectNode) tasks.path(i); |
|
||||||
ObjectNode workerGroupNode = (ObjectNode) task.path("workerGroupId"); |
|
||||||
int workerGroupId = -1; |
|
||||||
if (workerGroupNode != null && workerGroupNode.canConvertToInt()) { |
|
||||||
workerGroupId = workerGroupNode.asInt(-1); |
|
||||||
} |
|
||||||
if (workerGroupId == -1) { |
|
||||||
task.put("workerGroup", "default"); |
|
||||||
} else { |
|
||||||
task.put("workerGroup", oldWorkerGroupMap.get(workerGroupId)); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
jsonObject.remove("task"); |
|
||||||
|
|
||||||
jsonObject.put("tasks", tasks); |
|
||||||
|
|
||||||
replaceProcessDefinitionMap.put(entry.getKey(), jsonObject.toString()); |
|
||||||
} |
|
||||||
if (replaceProcessDefinitionMap.size() > 0) { |
|
||||||
processDefinitionDao.updateProcessDefinitionJson(connection, replaceProcessDefinitionMap); |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error("update process definition json workergroup error", e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public DolphinSchedulerVersion getCurrentVersion() { |
|
||||||
return DolphinSchedulerVersion.V1_3_0; |
|
||||||
} |
|
||||||
} |
|
@ -1,151 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package org.apache.dolphinscheduler.tools.datasource.upgrader.v132; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
|
||||||
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.dao.ProcessDefinitionDao; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.upgrader.DolphinSchedulerUpgrader; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.upgrader.DolphinSchedulerVersion; |
|
||||||
|
|
||||||
import org.apache.commons.collections4.CollectionUtils; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.List; |
|
||||||
import java.util.Map; |
|
||||||
import java.util.stream.Collectors; |
|
||||||
|
|
||||||
import javax.sql.DataSource; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.stereotype.Component; |
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.node.ArrayNode; |
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
||||||
|
|
||||||
@Slf4j |
|
||||||
@Component |
|
||||||
public class V132DolphinSchedulerUpgrader implements DolphinSchedulerUpgrader { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private DataSource dataSource; |
|
||||||
|
|
||||||
@Override |
|
||||||
public void doUpgrade() { |
|
||||||
updateProcessDefinitionJsonResourceList(); |
|
||||||
} |
|
||||||
|
|
||||||
private void updateProcessDefinitionJsonResourceList() { |
|
||||||
ProcessDefinitionDao processDefinitionDao = new ProcessDefinitionDao(); |
|
||||||
Map<Integer, String> replaceProcessDefinitionMap = new HashMap<>(); |
|
||||||
try (Connection connection = dataSource.getConnection()) { |
|
||||||
Map<String, Integer> resourcesMap = listAllResources(connection); |
|
||||||
Map<Integer, String> processDefinitionJsonMap = |
|
||||||
processDefinitionDao.queryAllProcessDefinition(connection); |
|
||||||
|
|
||||||
for (Map.Entry<Integer, String> entry : processDefinitionJsonMap.entrySet()) { |
|
||||||
ObjectNode jsonObject = JSONUtils.parseObject(entry.getValue()); |
|
||||||
ArrayNode tasks = JSONUtils.parseArray(jsonObject.get("tasks").toString()); |
|
||||||
|
|
||||||
for (int i = 0; i < tasks.size(); i++) { |
|
||||||
ObjectNode task = (ObjectNode) tasks.get(i); |
|
||||||
ObjectNode param = (ObjectNode) task.get("params"); |
|
||||||
if (param != null) { |
|
||||||
|
|
||||||
List<ResourceInfo> resourceList = |
|
||||||
JSONUtils.toList(param.get("resourceList").toString(), ResourceInfo.class); |
|
||||||
ResourceInfo mainJar = |
|
||||||
JSONUtils.parseObject(param.get("mainJar").toString(), ResourceInfo.class); |
|
||||||
if (mainJar != null && mainJar.getId() == null) { |
|
||||||
String fullName = mainJar.getRes().startsWith("/") ? mainJar.getRes() |
|
||||||
: String.format("/%s", mainJar.getRes()); |
|
||||||
if (resourcesMap.containsKey(fullName)) { |
|
||||||
mainJar.setId(resourcesMap.get(fullName)); |
|
||||||
param.put("mainJar", JSONUtils.parseObject(JSONUtils.toJsonString(mainJar))); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(resourceList)) { |
|
||||||
List<ResourceInfo> newResourceList = resourceList.stream().map(resInfo -> { |
|
||||||
String fullName = resInfo.getRes().startsWith("/") ? resInfo.getRes() |
|
||||||
: String.format("/%s", resInfo.getRes()); |
|
||||||
if (resInfo.getId() == null && resourcesMap.containsKey(fullName)) { |
|
||||||
resInfo.setId(resourcesMap.get(fullName)); |
|
||||||
} |
|
||||||
return resInfo; |
|
||||||
}).collect(Collectors.toList()); |
|
||||||
param.put("resourceList", JSONUtils.parseObject(JSONUtils.toJsonString(newResourceList))); |
|
||||||
} |
|
||||||
} |
|
||||||
task.put("params", param); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
jsonObject.remove("tasks"); |
|
||||||
|
|
||||||
jsonObject.put("tasks", tasks); |
|
||||||
|
|
||||||
replaceProcessDefinitionMap.put(entry.getKey(), jsonObject.toString()); |
|
||||||
} |
|
||||||
if (replaceProcessDefinitionMap.size() > 0) { |
|
||||||
processDefinitionDao.updateProcessDefinitionJson(connection, replaceProcessDefinitionMap); |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error("update process definition json resource list error", e); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* list all resources |
|
||||||
* |
|
||||||
* @param conn connection |
|
||||||
* @return map that key is full_name and value is id |
|
||||||
*/ |
|
||||||
private Map<String, Integer> listAllResources(Connection conn) { |
|
||||||
Map<String, Integer> resourceMap = new HashMap<>(); |
|
||||||
|
|
||||||
String sql = "SELECT id,full_name FROM t_ds_resources"; |
|
||||||
try ( |
|
||||||
PreparedStatement pstmt = conn.prepareStatement(sql); |
|
||||||
ResultSet rs = pstmt.executeQuery()) { |
|
||||||
|
|
||||||
while (rs.next()) { |
|
||||||
Integer id = rs.getInt(1); |
|
||||||
String fullName = rs.getString(2); |
|
||||||
resourceMap.put(fullName, id); |
|
||||||
} |
|
||||||
|
|
||||||
} catch (Exception e) { |
|
||||||
log.error(e.getMessage(), e); |
|
||||||
throw new RuntimeException("sql: " + sql, e); |
|
||||||
} |
|
||||||
|
|
||||||
return resourceMap; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public DolphinSchedulerVersion getCurrentVersion() { |
|
||||||
return DolphinSchedulerVersion.V1_3_2; |
|
||||||
} |
|
||||||
} |
|
@ -1,394 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package org.apache.dolphinscheduler.tools.datasource.upgrader.v200; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.common.constants.Constants; |
|
||||||
import org.apache.dolphinscheduler.common.enums.ConditionType; |
|
||||||
import org.apache.dolphinscheduler.common.enums.Flag; |
|
||||||
import org.apache.dolphinscheduler.common.enums.Priority; |
|
||||||
import org.apache.dolphinscheduler.common.enums.TimeoutFlag; |
|
||||||
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; |
|
||||||
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
|
||||||
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; |
|
||||||
import org.apache.dolphinscheduler.dao.entity.WorkflowDefinition; |
|
||||||
import org.apache.dolphinscheduler.dao.entity.WorkflowDefinitionLog; |
|
||||||
import org.apache.dolphinscheduler.dao.entity.WorkflowTaskRelationLog; |
|
||||||
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo; |
|
||||||
import org.apache.dolphinscheduler.plugin.task.api.parameters.TaskTimeoutParameter; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.dao.JsonSplitDao; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.dao.ProcessDefinitionDao; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.dao.ProjectDao; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.dao.ScheduleDao; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.upgrader.DolphinSchedulerUpgrader; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.upgrader.DolphinSchedulerVersion; |
|
||||||
import org.apache.dolphinscheduler.tools.datasource.upgrader.UpgradeDao; |
|
||||||
|
|
||||||
import org.apache.commons.collections4.CollectionUtils; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Date; |
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.List; |
|
||||||
import java.util.Map; |
|
||||||
import java.util.Optional; |
|
||||||
import java.util.stream.Collectors; |
|
||||||
|
|
||||||
import javax.sql.DataSource; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.context.annotation.Lazy; |
|
||||||
import org.springframework.stereotype.Component; |
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference; |
|
||||||
import com.fasterxml.jackson.databind.JsonNode; |
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper; |
|
||||||
import com.fasterxml.jackson.databind.node.ArrayNode; |
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
||||||
import com.google.common.base.Joiner; |
|
||||||
import com.google.common.base.Strings; |
|
||||||
|
|
||||||
@Slf4j |
|
||||||
@Component |
|
||||||
public class V200DolphinSchedulerUpgrader implements DolphinSchedulerUpgrader { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private DataSource dataSource; |
|
||||||
|
|
||||||
@Lazy() |
|
||||||
@Autowired |
|
||||||
private UpgradeDao upgradeDao; |
|
||||||
|
|
||||||
@Override |
|
||||||
public void doUpgrade() { |
|
||||||
processDefinitionJsonSplit(); |
|
||||||
upgradeDao.upgradeDolphinSchedulerDDL("2.0.0_schema", "dolphinscheduler_ddl_post.sql"); |
|
||||||
} |
|
||||||
|
|
||||||
private void processDefinitionJsonSplit() { |
|
||||||
ProjectDao projectDao = new ProjectDao(); |
|
||||||
ProcessDefinitionDao processDefinitionDao = new ProcessDefinitionDao(); |
|
||||||
ScheduleDao scheduleDao = new ScheduleDao(); |
|
||||||
JsonSplitDao jsonSplitDao = new JsonSplitDao(); |
|
||||||
try (Connection connection = dataSource.getConnection()) { |
|
||||||
// execute project
|
|
||||||
Map<Integer, Long> projectIdCodeMap = projectDao.queryAllProject(connection); |
|
||||||
projectDao.updateProjectCode(connection, projectIdCodeMap); |
|
||||||
|
|
||||||
// execute process definition code
|
|
||||||
List<WorkflowDefinition> workflowDefinitions = |
|
||||||
processDefinitionDao.queryProcessDefinition(connection); |
|
||||||
processDefinitionDao.updateProcessDefinitionCode(connection, workflowDefinitions, |
|
||||||
projectIdCodeMap); |
|
||||||
|
|
||||||
// execute schedule
|
|
||||||
Map<Integer, Long> allSchedule = scheduleDao.queryAllSchedule(connection); |
|
||||||
Map<Integer, Long> processIdCodeMap = workflowDefinitions.stream() |
|
||||||
.collect(Collectors.toMap(WorkflowDefinition::getId, WorkflowDefinition::getCode)); |
|
||||||
scheduleDao.updateScheduleCode(connection, allSchedule, processIdCodeMap); |
|
||||||
|
|
||||||
// json split
|
|
||||||
Map<Integer, String> processDefinitionJsonMap = |
|
||||||
processDefinitionDao.queryAllProcessDefinition(connection); |
|
||||||
List<WorkflowDefinitionLog> processDefinitionLogs = new ArrayList<>(); |
|
||||||
List<WorkflowTaskRelationLog> processTaskRelationLogs = new ArrayList<>(); |
|
||||||
List<TaskDefinitionLog> taskDefinitionLogs = new ArrayList<>(); |
|
||||||
Map<Integer, Map<Long, Map<String, Long>>> processTaskMap = new HashMap<>(); |
|
||||||
splitProcessDefinitionJson(workflowDefinitions, processDefinitionJsonMap, processDefinitionLogs, |
|
||||||
processTaskRelationLogs, taskDefinitionLogs, processTaskMap); |
|
||||||
convertDependence(taskDefinitionLogs, projectIdCodeMap, processTaskMap); |
|
||||||
|
|
||||||
// execute json split
|
|
||||||
jsonSplitDao.executeJsonSplitProcessDefinition(connection, processDefinitionLogs); |
|
||||||
jsonSplitDao.executeJsonSplitProcessTaskRelation(connection, processTaskRelationLogs); |
|
||||||
jsonSplitDao.executeJsonSplitTaskDefinition(connection, taskDefinitionLogs); |
|
||||||
} catch (Exception e) { |
|
||||||
log.error("json split error", e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void splitProcessDefinitionJson(List<WorkflowDefinition> workflowDefinitions, |
|
||||||
Map<Integer, String> processDefinitionJsonMap, |
|
||||||
List<WorkflowDefinitionLog> processDefinitionLogs, |
|
||||||
List<WorkflowTaskRelationLog> processTaskRelationLogs, |
|
||||||
List<TaskDefinitionLog> taskDefinitionLogs, |
|
||||||
Map<Integer, Map<Long, Map<String, Long>>> processTaskMap) throws Exception { |
|
||||||
Map<Integer, WorkflowDefinition> processDefinitionMap = workflowDefinitions.stream() |
|
||||||
.collect(Collectors.toMap(WorkflowDefinition::getId, processDefinition -> processDefinition)); |
|
||||||
Date now = new Date(); |
|
||||||
for (Map.Entry<Integer, String> entry : processDefinitionJsonMap.entrySet()) { |
|
||||||
if (entry.getValue() == null) { |
|
||||||
throw new Exception("processDefinitionJson is null"); |
|
||||||
} |
|
||||||
ObjectNode jsonObject = JSONUtils.parseObject(entry.getValue()); |
|
||||||
WorkflowDefinition workflowDefinition = processDefinitionMap.get(entry.getKey()); |
|
||||||
if (workflowDefinition != null) { |
|
||||||
workflowDefinition.setTimeout(jsonObject.get("timeout").asInt()); |
|
||||||
workflowDefinition.setGlobalParams(jsonObject.get("globalParams").toString()); |
|
||||||
} else { |
|
||||||
throw new Exception("It can't find processDefinition, please check !"); |
|
||||||
} |
|
||||||
Map<String, Long> taskIdCodeMap = new HashMap<>(); |
|
||||||
Map<String, List<String>> taskNamePreMap = new HashMap<>(); |
|
||||||
Map<String, Long> taskNameCodeMap = new HashMap<>(); |
|
||||||
Map<Long, Map<String, Long>> processCodeTaskNameCodeMap = new HashMap<>(); |
|
||||||
List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>(); |
|
||||||
ArrayNode tasks = JSONUtils.parseArray(jsonObject.get("tasks").toString()); |
|
||||||
for (int i = 0; i < tasks.size(); i++) { |
|
||||||
ObjectNode task = (ObjectNode) tasks.path(i); |
|
||||||
ObjectNode param = (ObjectNode) task.get("params"); |
|
||||||
TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(); |
|
||||||
String taskType = task.get("type").asText(); |
|
||||||
if (param != null) { |
|
||||||
JsonNode resourceJsonNode = param.get("resourceList"); |
|
||||||
if (resourceJsonNode != null && !resourceJsonNode.isEmpty()) { |
|
||||||
List<ResourceInfo> resourceList = |
|
||||||
JSONUtils.toList(param.get("resourceList").toString(), ResourceInfo.class); |
|
||||||
List<Integer> resourceIds = |
|
||||||
resourceList.stream().map(ResourceInfo::getId).collect(Collectors.toList()); |
|
||||||
taskDefinitionLog.setResourceIds(Joiner.on(Constants.COMMA).join(resourceIds)); |
|
||||||
} else { |
|
||||||
taskDefinitionLog.setResourceIds(""); |
|
||||||
} |
|
||||||
if ("SUB_PROCESS".equals(taskType)) { |
|
||||||
JsonNode jsonNodeDefinitionId = param.get("processDefinitionId"); |
|
||||||
if (jsonNodeDefinitionId != null) { |
|
||||||
param.put("processDefinitionCode", |
|
||||||
processDefinitionMap.get(jsonNodeDefinitionId.asInt()).getCode()); |
|
||||||
param.remove("processDefinitionId"); |
|
||||||
} |
|
||||||
} |
|
||||||
param.put("conditionResult", task.get("conditionResult")); |
|
||||||
param.put("dependence", task.get("dependence")); |
|
||||||
taskDefinitionLog.setTaskParams(JSONUtils.toJsonString(param)); |
|
||||||
} |
|
||||||
TaskTimeoutParameter timeout = |
|
||||||
JSONUtils.parseObject(JSONUtils.toJsonString(task.get("timeout")), TaskTimeoutParameter.class); |
|
||||||
if (timeout != null) { |
|
||||||
taskDefinitionLog.setTimeout(timeout.getInterval()); |
|
||||||
taskDefinitionLog.setTimeoutFlag(timeout.getEnable() ? TimeoutFlag.OPEN : TimeoutFlag.CLOSE); |
|
||||||
taskDefinitionLog.setTimeoutNotifyStrategy(timeout.getStrategy()); |
|
||||||
} |
|
||||||
String desc = task.get("description") != null ? task.get("description").asText() |
|
||||||
: task.get("desc") != null ? task.get("desc").asText() : ""; |
|
||||||
taskDefinitionLog.setDescription(desc); |
|
||||||
taskDefinitionLog.setFlag( |
|
||||||
Constants.FLOWNODE_RUN_FLAG_NORMAL.equals(task.get("runFlag").asText()) ? Flag.YES : Flag.NO); |
|
||||||
taskDefinitionLog.setTaskType(taskType); |
|
||||||
taskDefinitionLog.setFailRetryInterval( |
|
||||||
"SUB_PROCESS".equals(taskType) ? 1 : task.get("retryInterval").asInt()); |
|
||||||
taskDefinitionLog.setFailRetryTimes( |
|
||||||
"SUB_PROCESS".equals(taskType) ? 0 : task.get("maxRetryTimes").asInt()); |
|
||||||
taskDefinitionLog.setTaskPriority(JSONUtils |
|
||||||
.parseObject(JSONUtils.toJsonString(task.get("taskInstancePriority")), Priority.class)); |
|
||||||
String name = task.get("name").asText(); |
|
||||||
taskDefinitionLog.setName(name); |
|
||||||
taskDefinitionLog |
|
||||||
.setWorkerGroup(task.get("workerGroup") == null ? "default" : task.get("workerGroup").asText()); |
|
||||||
long taskCode = CodeGenerateUtils.genCode(); |
|
||||||
taskDefinitionLog.setCode(taskCode); |
|
||||||
taskDefinitionLog.setVersion(Constants.VERSION_FIRST); |
|
||||||
taskDefinitionLog.setProjectCode(workflowDefinition.getProjectCode()); |
|
||||||
taskDefinitionLog.setUserId(workflowDefinition.getUserId()); |
|
||||||
taskDefinitionLog.setEnvironmentCode(-1); |
|
||||||
taskDefinitionLog.setDelayTime(0); |
|
||||||
taskDefinitionLog.setOperator(1); |
|
||||||
taskDefinitionLog.setOperateTime(now); |
|
||||||
taskDefinitionLog.setCreateTime(now); |
|
||||||
taskDefinitionLog.setUpdateTime(now); |
|
||||||
taskDefinitionLogList.add(taskDefinitionLog); |
|
||||||
taskIdCodeMap.put(task.get("id").asText(), taskCode); |
|
||||||
List<String> preTasks = JSONUtils.toList(task.get("preTasks").toString(), String.class); |
|
||||||
taskNamePreMap.put(name, preTasks); |
|
||||||
taskNameCodeMap.put(name, taskCode); |
|
||||||
} |
|
||||||
convertConditions(taskDefinitionLogList, taskNameCodeMap); |
|
||||||
taskDefinitionLogs.addAll(taskDefinitionLogList); |
|
||||||
workflowDefinition.setLocations(convertLocations(workflowDefinition.getLocations(), taskIdCodeMap)); |
|
||||||
WorkflowDefinitionLog processDefinitionLog = new WorkflowDefinitionLog(workflowDefinition); |
|
||||||
processDefinitionLog.setOperator(1); |
|
||||||
processDefinitionLog.setOperateTime(now); |
|
||||||
processDefinitionLog.setUpdateTime(now); |
|
||||||
processDefinitionLogs.add(processDefinitionLog); |
|
||||||
handleProcessTaskRelation(taskNamePreMap, taskNameCodeMap, workflowDefinition, processTaskRelationLogs); |
|
||||||
processCodeTaskNameCodeMap.put(workflowDefinition.getCode(), taskNameCodeMap); |
|
||||||
processTaskMap.put(entry.getKey(), processCodeTaskNameCodeMap); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void convertDependence(List<TaskDefinitionLog> taskDefinitionLogs, |
|
||||||
Map<Integer, Long> projectIdCodeMap, |
|
||||||
Map<Integer, Map<Long, Map<String, Long>>> processTaskMap) { |
|
||||||
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { |
|
||||||
if ("DEPENDENT".equals(taskDefinitionLog.getTaskType())) { |
|
||||||
ObjectNode taskParams = JSONUtils.parseObject(taskDefinitionLog.getTaskParams()); |
|
||||||
ObjectNode dependence = (ObjectNode) taskParams.get("dependence"); |
|
||||||
ArrayNode dependTaskList = |
|
||||||
JSONUtils.parseArray(JSONUtils.toJsonString(dependence.get("dependTaskList"))); |
|
||||||
for (int i = 0; i < dependTaskList.size(); i++) { |
|
||||||
ObjectNode dependTask = (ObjectNode) dependTaskList.path(i); |
|
||||||
ArrayNode dependItemList = |
|
||||||
JSONUtils.parseArray(JSONUtils.toJsonString(dependTask.get("dependItemList"))); |
|
||||||
for (int j = 0; j < dependItemList.size(); j++) { |
|
||||||
ObjectNode dependItem = (ObjectNode) dependItemList.path(j); |
|
||||||
dependItem.put("projectCode", projectIdCodeMap.get(dependItem.get("projectId").asInt())); |
|
||||||
int definitionId = dependItem.get("definitionId").asInt(); |
|
||||||
Map<Long, Map<String, Long>> processCodeTaskNameCodeMap = processTaskMap.get(definitionId); |
|
||||||
if (processCodeTaskNameCodeMap == null) { |
|
||||||
log.warn( |
|
||||||
"We can't find processDefinition [{}], please check it is not exist, remove this dependence", |
|
||||||
definitionId); |
|
||||||
dependItemList.remove(j); |
|
||||||
continue; |
|
||||||
} |
|
||||||
Optional<Map.Entry<Long, Map<String, Long>>> mapEntry = |
|
||||||
processCodeTaskNameCodeMap.entrySet().stream().findFirst(); |
|
||||||
if (mapEntry.isPresent()) { |
|
||||||
Map.Entry<Long, Map<String, Long>> processCodeTaskNameCodeEntry = mapEntry.get(); |
|
||||||
dependItem.put("definitionCode", processCodeTaskNameCodeEntry.getKey()); |
|
||||||
String depTasks = dependItem.get("depTasks").asText(); |
|
||||||
long taskCode = |
|
||||||
"ALL".equals(depTasks) || processCodeTaskNameCodeEntry.getValue() == null ? 0L |
|
||||||
: processCodeTaskNameCodeEntry.getValue().get(depTasks); |
|
||||||
dependItem.put("depTaskCode", taskCode); |
|
||||||
} |
|
||||||
dependItem.remove("projectId"); |
|
||||||
dependItem.remove("definitionId"); |
|
||||||
dependItem.remove("depTasks"); |
|
||||||
dependItemList.set(j, dependItem); |
|
||||||
} |
|
||||||
dependTask.put("dependItemList", dependItemList); |
|
||||||
dependTaskList.set(i, dependTask); |
|
||||||
} |
|
||||||
dependence.put("dependTaskList", dependTaskList); |
|
||||||
taskDefinitionLog.setTaskParams(JSONUtils.toJsonString(taskParams)); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void convertConditions(List<TaskDefinitionLog> taskDefinitionLogList, |
|
||||||
Map<String, Long> taskNameCodeMap) throws Exception { |
|
||||||
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogList) { |
|
||||||
if ("CONDITIONS".equals(taskDefinitionLog.getTaskType())) { |
|
||||||
ObjectMapper objectMapper = new ObjectMapper(); |
|
||||||
ObjectNode taskParams = JSONUtils.parseObject(taskDefinitionLog.getTaskParams()); |
|
||||||
// reset conditionResult
|
|
||||||
ObjectNode conditionResult = (ObjectNode) taskParams.get("conditionResult"); |
|
||||||
List<String> successNode = |
|
||||||
JSONUtils.toList(conditionResult.get("successNode").toString(), String.class); |
|
||||||
List<Long> nodeCode = new ArrayList<>(); |
|
||||||
successNode.forEach(node -> nodeCode.add(taskNameCodeMap.get(node))); |
|
||||||
conditionResult.set("successNode", objectMapper.readTree(objectMapper.writeValueAsString(nodeCode))); |
|
||||||
List<String> failedNode = JSONUtils.toList(conditionResult.get("failedNode").toString(), String.class); |
|
||||||
nodeCode.clear(); |
|
||||||
failedNode.forEach(node -> nodeCode.add(taskNameCodeMap.get(node))); |
|
||||||
conditionResult.set("failedNode", objectMapper.readTree(objectMapper.writeValueAsString(nodeCode))); |
|
||||||
// reset dependItemList
|
|
||||||
ObjectNode dependence = (ObjectNode) taskParams.get("dependence"); |
|
||||||
ArrayNode dependTaskList = |
|
||||||
JSONUtils.parseArray(JSONUtils.toJsonString(dependence.get("dependTaskList"))); |
|
||||||
for (int i = 0; i < dependTaskList.size(); i++) { |
|
||||||
ObjectNode dependTask = (ObjectNode) dependTaskList.path(i); |
|
||||||
ArrayNode dependItemList = |
|
||||||
JSONUtils.parseArray(JSONUtils.toJsonString(dependTask.get("dependItemList"))); |
|
||||||
for (int j = 0; j < dependItemList.size(); j++) { |
|
||||||
ObjectNode dependItem = (ObjectNode) dependItemList.path(j); |
|
||||||
JsonNode depTasks = dependItem.get("depTasks"); |
|
||||||
dependItem.put("depTaskCode", taskNameCodeMap.get(depTasks.asText())); |
|
||||||
dependItem.remove("depTasks"); |
|
||||||
dependItemList.set(j, dependItem); |
|
||||||
} |
|
||||||
dependTask.put("dependItemList", dependItemList); |
|
||||||
dependTaskList.set(i, dependTask); |
|
||||||
} |
|
||||||
dependence.put("dependTaskList", dependTaskList); |
|
||||||
taskDefinitionLog.setTaskParams(JSONUtils.toJsonString(taskParams)); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private String convertLocations(String locations, Map<String, Long> taskIdCodeMap) { |
|
||||||
if (Strings.isNullOrEmpty(locations)) { |
|
||||||
return locations; |
|
||||||
} |
|
||||||
Map<String, ObjectNode> locationsMap = |
|
||||||
JSONUtils.parseObject(locations, new TypeReference<Map<String, ObjectNode>>() { |
|
||||||
}); |
|
||||||
if (locationsMap == null) { |
|
||||||
return locations; |
|
||||||
} |
|
||||||
ArrayNode jsonNodes = JSONUtils.createArrayNode(); |
|
||||||
for (Map.Entry<String, ObjectNode> entry : locationsMap.entrySet()) { |
|
||||||
ObjectNode nodes = JSONUtils.createObjectNode(); |
|
||||||
nodes.put("taskCode", taskIdCodeMap.get(entry.getKey())); |
|
||||||
ObjectNode oldNodes = entry.getValue(); |
|
||||||
nodes.put("x", oldNodes.get("x").asInt()); |
|
||||||
nodes.put("y", oldNodes.get("y").asInt()); |
|
||||||
jsonNodes.add(nodes); |
|
||||||
} |
|
||||||
return jsonNodes.toString(); |
|
||||||
} |
|
||||||
|
|
||||||
private void handleProcessTaskRelation(Map<String, List<String>> taskNamePreMap, |
|
||||||
Map<String, Long> taskNameCodeMap, |
|
||||||
WorkflowDefinition workflowDefinition, |
|
||||||
List<WorkflowTaskRelationLog> processTaskRelationLogs) { |
|
||||||
Date now = new Date(); |
|
||||||
for (Map.Entry<String, List<String>> entry : taskNamePreMap.entrySet()) { |
|
||||||
List<String> entryValue = entry.getValue(); |
|
||||||
if (CollectionUtils.isNotEmpty(entryValue)) { |
|
||||||
for (String preTaskName : entryValue) { |
|
||||||
WorkflowTaskRelationLog processTaskRelationLog = setProcessTaskRelationLog(workflowDefinition, now); |
|
||||||
processTaskRelationLog.setPreTaskCode(taskNameCodeMap.get(preTaskName)); |
|
||||||
processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST); |
|
||||||
processTaskRelationLog.setPostTaskCode(taskNameCodeMap.get(entry.getKey())); |
|
||||||
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); |
|
||||||
processTaskRelationLogs.add(processTaskRelationLog); |
|
||||||
} |
|
||||||
} else { |
|
||||||
WorkflowTaskRelationLog processTaskRelationLog = setProcessTaskRelationLog(workflowDefinition, now); |
|
||||||
processTaskRelationLog.setPreTaskCode(0); |
|
||||||
processTaskRelationLog.setPreTaskVersion(0); |
|
||||||
processTaskRelationLog.setPostTaskCode(taskNameCodeMap.get(entry.getKey())); |
|
||||||
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); |
|
||||||
processTaskRelationLogs.add(processTaskRelationLog); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private WorkflowTaskRelationLog setProcessTaskRelationLog(WorkflowDefinition workflowDefinition, Date now) { |
|
||||||
WorkflowTaskRelationLog processTaskRelationLog = new WorkflowTaskRelationLog(); |
|
||||||
processTaskRelationLog.setProjectCode(workflowDefinition.getProjectCode()); |
|
||||||
processTaskRelationLog.setProcessDefinitionCode(workflowDefinition.getCode()); |
|
||||||
processTaskRelationLog.setProcessDefinitionVersion(workflowDefinition.getVersion()); |
|
||||||
processTaskRelationLog.setConditionType(ConditionType.NONE); |
|
||||||
processTaskRelationLog.setConditionParams("{}"); |
|
||||||
processTaskRelationLog.setOperator(1); |
|
||||||
processTaskRelationLog.setOperateTime(now); |
|
||||||
processTaskRelationLog.setCreateTime(now); |
|
||||||
processTaskRelationLog.setUpdateTime(now); |
|
||||||
return processTaskRelationLog; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public DolphinSchedulerVersion getCurrentVersion() { |
|
||||||
return DolphinSchedulerVersion.V2_0_0; |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue