From d168a3cdf7cec9689dc8ae439c4a02ab10922287 Mon Sep 17 00:00:00 2001 From: OS <29528966+lenboo@users.noreply.github.com> Date: Fri, 12 Nov 2021 12:03:23 +0800 Subject: [PATCH] [feature][Install] 6597 add worker group when upgrading from version 1.x to 2.0 (#6806) * feature 6597 add worker group. Upgrade dolphinscheduler version 1. X to version 2.0 * feature 6597 add worker group. Upgrade dolphinscheduler version 1. X to version 2.0 * code style * code style * code style * code style * update postgre sql Co-authored-by: JinYong Li <42576980+JinyLeeChina@users.noreply.github.com> --- .../2.0.0_schema/mysql/dolphinscheduler_ddl.sql | 12 ++++++++++++ .../postgresql/dolphinscheduler_ddl.sql | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl.sql index 2b8d4942ce..4537604e0a 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl.sql @@ -352,6 +352,18 @@ CREATE TABLE `t_ds_process_task_relation_log` ( 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; + -- 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; diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl.sql index e68781b545..569ff693ef 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl.sql @@ -210,7 +210,7 @@ BEGIN )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_task_definition" ( - id int NOT NULL , + id serial NOT NULL , code bigint NOT NULL, name varchar(255) DEFAULT NULL , version int NOT NULL , @@ -264,7 +264,7 @@ BEGIN )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_process_task_relation" ( - id int NOT NULL , + id serial NOT NULL , name varchar(255) DEFAULT NULL , project_code bigint DEFAULT NULL , process_definition_code bigint DEFAULT NULL , @@ -298,6 +298,17 @@ BEGIN 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), + UNIQUE KEY name_unique (name) + )'; + return 'Success!'; exception when others then ---Raise EXCEPTION '(%)',SQLERRM;