Browse Source

rename worker_group_id to worker_group and set the value of worker_group_name (#2801)

pull/3/MERGE
lgcareer 5 years ago committed by GitHub
parent
commit
470bd59db7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 160
      sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_ddl.sql
  2. 5
      sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_dml.sql
  3. 170
      sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql
  4. 5
      sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_dml.sql

160
sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_ddl.sql

@ -157,205 +157,105 @@ CALL ac_dolphin_T_t_ds_process_definition_A_resource_ids;
DROP PROCEDURE ac_dolphin_T_t_ds_process_definition_A_resource_ids; DROP PROCEDURE ac_dolphin_T_t_ds_process_definition_A_resource_ids;
-- ac_dolphin_T_t_ds_process_instance_A_worker_group -- uc_dolphin_T_t_ds_process_instance_R_worker_group_id
drop PROCEDURE if EXISTS ac_dolphin_T_t_ds_process_instance_A_worker_group; drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_instance_R_worker_group_id;
delimiter d// delimiter d//
CREATE PROCEDURE ac_dolphin_T_t_ds_process_instance_A_worker_group() CREATE PROCEDURE uc_dolphin_T_t_ds_process_instance_R_worker_group_id()
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 ='worker_group')
THEN
ALTER TABLE t_ds_process_instance ADD `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group';
END IF;
END;
d//
delimiter ;
CALL ac_dolphin_T_t_ds_process_instance_A_worker_group;
DROP PROCEDURE ac_dolphin_T_t_ds_process_instance_A_worker_group;
-- dc_dolphin_T_t_ds_process_instance_D_worker_group_id
drop PROCEDURE if EXISTS dc_dolphin_T_t_ds_process_instance_D_worker_group_id;
delimiter d//
CREATE PROCEDURE dc_dolphin_T_t_ds_process_instance_D_worker_group_id()
BEGIN BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_process_instance' WHERE TABLE_NAME='t_ds_process_instance'
AND TABLE_SCHEMA=(SELECT DATABASE()) AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='worker_group_id') AND COLUMN_NAME ='worker_group_id')
THEN THEN
ALTER TABLE t_ds_process_instance DROP COLUMN worker_group_id; ALTER TABLE t_ds_process_instance change `worker_group_id` `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group';
END IF; END IF;
END; END;
d// d//
delimiter ; delimiter ;
CALL dc_dolphin_T_t_ds_process_instance_D_worker_group_id; CALL uc_dolphin_T_t_ds_process_instance_R_worker_group_id;
DROP PROCEDURE dc_dolphin_T_t_ds_process_instance_D_worker_group_id; DROP PROCEDURE uc_dolphin_T_t_ds_process_instance_R_worker_group_id;
-- ac_dolphin_T_t_ds_task_instance_A_worker_group -- uc_dolphin_T_t_ds_task_instance_R_worker_group_id
drop PROCEDURE if EXISTS ac_dolphin_T_t_ds_task_instance_A_worker_group; drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_task_instance_R_worker_group_id;
delimiter d// delimiter d//
CREATE PROCEDURE ac_dolphin_T_t_ds_task_instance_A_worker_group() CREATE PROCEDURE uc_dolphin_T_t_ds_task_instance_R_worker_group_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 ='worker_group')
THEN
ALTER TABLE t_ds_task_instance ADD `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group';
END IF;
END;
d//
delimiter ;
CALL ac_dolphin_T_t_ds_task_instance_A_worker_group;
DROP PROCEDURE ac_dolphin_T_t_ds_task_instance_A_worker_group;
-- dc_dolphin_T_t_ds_task_instance_D_worker_group_id
drop PROCEDURE if EXISTS dc_dolphin_T_t_ds_task_instance_D_worker_group_id;
delimiter d//
CREATE PROCEDURE dc_dolphin_T_t_ds_task_instance_D_worker_group_id()
BEGIN BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_task_instance' WHERE TABLE_NAME='t_ds_task_instance'
AND TABLE_SCHEMA=(SELECT DATABASE()) AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='worker_group_id') AND COLUMN_NAME ='worker_group_id')
THEN THEN
ALTER TABLE t_ds_task_instance DROP COLUMN worker_group_id; ALTER TABLE t_ds_task_instance change `worker_group_id` `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group';
END IF; END IF;
END; END;
d// d//
delimiter ; delimiter ;
CALL dc_dolphin_T_t_ds_task_instance_D_worker_group_id; CALL uc_dolphin_T_t_ds_task_instance_R_worker_group_id;
DROP PROCEDURE dc_dolphin_T_t_ds_task_instance_D_worker_group_id; DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_R_worker_group_id;
-- ac_dolphin_T_t_ds_schedules_A_worker_group -- uc_dolphin_T_t_ds_schedules_R_worker_group_id
drop PROCEDURE if EXISTS ac_dolphin_T_t_ds_schedules_A_worker_group; drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_schedules_R_worker_group_id;
delimiter d// delimiter d//
CREATE PROCEDURE ac_dolphin_T_t_ds_schedules_A_worker_group() CREATE PROCEDURE uc_dolphin_T_t_ds_schedules_R_worker_group_id()
BEGIN
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_schedules'
AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='worker_group')
THEN
ALTER TABLE t_ds_schedules ADD `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group';
END IF;
END;
d//
delimiter ;
CALL ac_dolphin_T_t_ds_schedules_A_worker_group;
DROP PROCEDURE ac_dolphin_T_t_ds_schedules_A_worker_group;
-- dc_dolphin_T_t_ds_schedules_D_worker_group_id
drop PROCEDURE if EXISTS dc_dolphin_T_t_ds_schedules_D_worker_group_id;
delimiter d//
CREATE PROCEDURE dc_dolphin_T_t_ds_schedules_D_worker_group_id()
BEGIN BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_schedules' WHERE TABLE_NAME='t_ds_schedules'
AND TABLE_SCHEMA=(SELECT DATABASE()) AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='worker_group_id') AND COLUMN_NAME ='worker_group_id')
THEN THEN
ALTER TABLE t_ds_schedules DROP COLUMN worker_group_id; ALTER TABLE t_ds_schedules change `worker_group_id` `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group';
END IF;
END;
d//
delimiter ;
CALL dc_dolphin_T_t_ds_schedules_D_worker_group_id;
DROP PROCEDURE dc_dolphin_T_t_ds_schedules_D_worker_group_id;
-- ac_dolphin_T_t_ds_command_A_worker_group
drop PROCEDURE if EXISTS ac_dolphin_T_t_ds_command_A_worker_group;
delimiter d//
CREATE PROCEDURE ac_dolphin_T_t_ds_command_A_worker_group()
BEGIN
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_command'
AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='worker_group')
THEN
ALTER TABLE t_ds_command ADD `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group';
END IF; END IF;
END; END;
d// d//
delimiter ; delimiter ;
CALL ac_dolphin_T_t_ds_command_A_worker_group; CALL uc_dolphin_T_t_ds_schedules_R_worker_group_id;
DROP PROCEDURE ac_dolphin_T_t_ds_command_A_worker_group; DROP PROCEDURE uc_dolphin_T_t_ds_schedules_R_worker_group_id;
-- dc_dolphin_T_t_ds_command_D_worker_group_id -- uc_dolphin_T_t_ds_command_R_worker_group_id
drop PROCEDURE if EXISTS dc_dolphin_T_t_ds_command_D_worker_group_id; drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_command_R_worker_group_id;
delimiter d// delimiter d//
CREATE PROCEDURE dc_dolphin_T_t_ds_command_D_worker_group_id() CREATE PROCEDURE uc_dolphin_T_t_ds_command_R_worker_group_id()
BEGIN BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_command' WHERE TABLE_NAME='t_ds_command'
AND TABLE_SCHEMA=(SELECT DATABASE()) AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='worker_group_id') AND COLUMN_NAME ='worker_group_id')
THEN THEN
ALTER TABLE t_ds_command DROP COLUMN worker_group_id; ALTER TABLE t_ds_command change `worker_group_id` `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group';
END IF;
END;
d//
delimiter ;
CALL dc_dolphin_T_t_ds_command_D_worker_group_id;
DROP PROCEDURE dc_dolphin_T_t_ds_command_D_worker_group_id;
-- ac_dolphin_T_t_ds_error_command_A_worker_group
drop PROCEDURE if EXISTS ac_dolphin_T_t_ds_error_command_A_worker_group;
delimiter d//
CREATE PROCEDURE ac_dolphin_T_t_ds_error_command_A_worker_group()
BEGIN
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_error_command'
AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='worker_group')
THEN
ALTER TABLE t_ds_error_command ADD `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group';
END IF; END IF;
END; END;
d// d//
delimiter ; delimiter ;
CALL ac_dolphin_T_t_ds_error_command_A_worker_group; CALL uc_dolphin_T_t_ds_command_R_worker_group_id;
DROP PROCEDURE ac_dolphin_T_t_ds_error_command_A_worker_group; DROP PROCEDURE uc_dolphin_T_t_ds_command_R_worker_group_id;
-- dc_dolphin_T_t_ds_error_command_D_worker_group_id -- uc_dolphin_T_t_ds_error_command_R_worker_group_id
drop PROCEDURE if EXISTS dc_dolphin_T_t_ds_error_command_D_worker_group_id; drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_error_command_R_worker_group_id;
delimiter d// delimiter d//
CREATE PROCEDURE dc_dolphin_T_t_ds_error_command_D_worker_group_id() CREATE PROCEDURE uc_dolphin_T_t_ds_error_command_R_worker_group_id()
BEGIN BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_error_command' WHERE TABLE_NAME='t_ds_error_command'
AND TABLE_SCHEMA=(SELECT DATABASE()) AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='worker_group_id') AND COLUMN_NAME ='worker_group_id')
THEN THEN
ALTER TABLE t_ds_error_command DROP COLUMN worker_group_id; ALTER TABLE t_ds_error_command change `worker_group_id` `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group';
END IF; END IF;
END; END;
d// d//
delimiter ; delimiter ;
CALL dc_dolphin_T_t_ds_error_command_D_worker_group_id; CALL uc_dolphin_T_t_ds_error_command_R_worker_group_id;
DROP PROCEDURE dc_dolphin_T_t_ds_error_command_D_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 -- 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; drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_definition_A_process_definition_unique;

5
sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_dml.sql

@ -19,3 +19,8 @@ SET FOREIGN_KEY_CHECKS=0;
UPDATE t_ds_resources SET pid=-1,is_directory=false WHERE pid IS NULL; 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 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 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');

170
sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql

@ -152,32 +152,11 @@ select ac_dolphin_T_t_ds_process_definition_A_resource_ids();
DROP FUNCTION ac_dolphin_T_t_ds_process_definition_A_resource_ids(); DROP FUNCTION ac_dolphin_T_t_ds_process_definition_A_resource_ids();
-- ac_dolphin_T_t_ds_process_instance_A_worker_group -- uc_dolphin_T_t_ds_process_instance_R_worker_group_id
delimiter ; delimiter ;
DROP FUNCTION IF EXISTS ac_dolphin_T_t_ds_process_instance_A_worker_group(); DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_process_instance_R_worker_group_id();
delimiter d// delimiter d//
CREATE FUNCTION ac_dolphin_T_t_ds_process_instance_A_worker_group() RETURNS void AS $$ CREATE FUNCTION uc_dolphin_T_t_ds_process_instance_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_process_instance'
AND COLUMN_NAME ='worker_group')
THEN
ALTER TABLE t_ds_process_instance ADD COLUMN worker_group varchar(64) DEFAULT null;
END IF;
END;
$$ LANGUAGE plpgsql;
d//
delimiter ;
select ac_dolphin_T_t_ds_process_instance_A_worker_group();
DROP FUNCTION ac_dolphin_T_t_ds_process_instance_A_worker_group();
-- dc_dolphin_T_t_ds_process_instance_D_worker_group_id
delimiter ;
DROP FUNCTION IF EXISTS dc_dolphin_T_t_ds_process_instance_D_worker_group_id();
delimiter d//
CREATE FUNCTION dc_dolphin_T_t_ds_process_instance_D_worker_group_id() RETURNS void AS $$
BEGIN BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_CATALOG=current_database() WHERE TABLE_CATALOG=current_database()
@ -185,42 +164,22 @@ BEGIN
AND TABLE_NAME='t_ds_process_instance' AND TABLE_NAME='t_ds_process_instance'
AND COLUMN_NAME ='worker_group_id') AND COLUMN_NAME ='worker_group_id')
THEN THEN
ALTER TABLE t_ds_process_instance DROP COLUMN worker_group_id; 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 IF;
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
d// d//
delimiter ; delimiter ;
select dc_dolphin_T_t_ds_process_instance_D_worker_group_id(); select uc_dolphin_T_t_ds_process_instance_R_worker_group_id();
DROP FUNCTION dc_dolphin_T_t_ds_process_instance_D_worker_group_id(); DROP FUNCTION uc_dolphin_T_t_ds_process_instance_R_worker_group_id();
-- ac_dolphin_T_t_ds_task_instance_A_worker_group -- uc_dolphin_T_t_ds_task_instance_R_worker_group_id
delimiter ;
DROP FUNCTION IF EXISTS ac_dolphin_T_t_ds_task_instance_A_worker_group();
delimiter d//
CREATE FUNCTION ac_dolphin_T_t_ds_task_instance_A_worker_group() 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_task_instance'
AND COLUMN_NAME ='worker_group')
THEN
ALTER TABLE t_ds_task_instance ADD COLUMN worker_group varchar(64) DEFAULT null;
END IF;
END;
$$ LANGUAGE plpgsql;
d//
delimiter ;
select ac_dolphin_T_t_ds_task_instance_A_worker_group();
DROP FUNCTION ac_dolphin_T_t_ds_task_instance_A_worker_group();
-- dc_dolphin_T_t_ds_task_instance_D_worker_group_id
delimiter ; delimiter ;
DROP FUNCTION IF EXISTS dc_dolphin_T_t_ds_task_instance_D_worker_group_id(); DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_task_instance_R_worker_group_id();
delimiter d// delimiter d//
CREATE FUNCTION dc_dolphin_T_t_ds_task_instance_D_worker_group_id() RETURNS void AS $$ CREATE FUNCTION uc_dolphin_T_t_ds_task_instance_R_worker_group_id() RETURNS void AS $$
BEGIN BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_CATALOG=current_database() WHERE TABLE_CATALOG=current_database()
@ -228,41 +187,21 @@ BEGIN
AND TABLE_NAME='t_ds_task_instance' AND TABLE_NAME='t_ds_task_instance'
AND COLUMN_NAME ='worker_group_id') AND COLUMN_NAME ='worker_group_id')
THEN THEN
ALTER TABLE t_ds_task_instance DROP COLUMN worker_group_id; 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 IF;
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
d// d//
delimiter ; delimiter ;
select dc_dolphin_T_t_ds_task_instance_D_worker_group_id(); select uc_dolphin_T_t_ds_task_instance_R_worker_group_id();
DROP FUNCTION dc_dolphin_T_t_ds_task_instance_D_worker_group_id(); DROP FUNCTION uc_dolphin_T_t_ds_task_instance_R_worker_group_id();
-- ac_dolphin_T_t_ds_schedules_A_worker_group -- uc_dolphin_T_t_ds_schedules_R_worker_group_id
delimiter ; delimiter ;
DROP FUNCTION IF EXISTS ac_dolphin_T_t_ds_schedules_A_worker_group(); DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_schedules_R_worker_group_id();
delimiter d// delimiter d//
CREATE FUNCTION ac_dolphin_T_t_ds_schedules_A_worker_group() RETURNS void AS $$ CREATE FUNCTION uc_dolphin_T_t_ds_schedules_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_schedules'
AND COLUMN_NAME ='worker_group')
THEN
ALTER TABLE t_ds_schedules ADD COLUMN worker_group varchar(64) DEFAULT null;
END IF;
END;
$$ LANGUAGE plpgsql;
d//
delimiter ;
select ac_dolphin_T_t_ds_schedules_A_worker_group();
DROP FUNCTION ac_dolphin_T_t_ds_schedules_A_worker_group();
-- dc_dolphin_T_t_ds_schedules_D_worker_group_id
delimiter ;
DROP FUNCTION IF EXISTS dc_dolphin_T_t_ds_schedules_D_worker_group_id();
delimiter d//
CREATE FUNCTION dc_dolphin_T_t_ds_schedules_D_worker_group_id() RETURNS void AS $$
BEGIN BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_CATALOG=current_database() WHERE TABLE_CATALOG=current_database()
@ -270,20 +209,21 @@ BEGIN
AND TABLE_NAME='t_ds_schedules' AND TABLE_NAME='t_ds_schedules'
AND COLUMN_NAME ='worker_group_id') AND COLUMN_NAME ='worker_group_id')
THEN THEN
ALTER TABLE t_ds_schedules DROP COLUMN worker_group_id; 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 IF;
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
d// d//
delimiter ; delimiter ;
select dc_dolphin_T_t_ds_schedules_D_worker_group_id(); select uc_dolphin_T_t_ds_schedules_R_worker_group_id();
DROP FUNCTION dc_dolphin_T_t_ds_schedules_D_worker_group_id(); DROP FUNCTION uc_dolphin_T_t_ds_schedules_R_worker_group_id();
-- ac_dolphin_T_t_ds_command_A_worker_group -- uc_dolphin_T_t_ds_command_R_worker_group_id
delimiter ; delimiter ;
DROP FUNCTION IF EXISTS ac_dolphin_T_t_ds_command_A_worker_group(); DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_command_R_worker_group_id();
delimiter d// delimiter d//
CREATE FUNCTION ac_dolphin_T_t_ds_command_A_worker_group() RETURNS void AS $$ CREATE FUNCTION uc_dolphin_T_t_ds_command_R_worker_group_id() RETURNS void AS $$
BEGIN BEGIN
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_CATALOG=current_database() WHERE TABLE_CATALOG=current_database()
@ -291,62 +231,21 @@ BEGIN
AND TABLE_NAME='t_ds_command' AND TABLE_NAME='t_ds_command'
AND COLUMN_NAME ='worker_group') AND COLUMN_NAME ='worker_group')
THEN THEN
ALTER TABLE t_ds_command ADD COLUMN worker_group varchar(64) DEFAULT null; ALTER TABLE t_ds_command rename worker_group_id to worker_group;
END IF; ALTER TABLE t_ds_command alter column worker_group type varchar(64);
END;
$$ LANGUAGE plpgsql;
d//
delimiter ;
select ac_dolphin_T_t_ds_command_A_worker_group();
DROP FUNCTION ac_dolphin_T_t_ds_command_A_worker_group();
-- dc_dolphin_T_t_ds_command_D_worker_group_id
delimiter ;
DROP FUNCTION IF EXISTS dc_dolphin_T_t_ds_command_D_worker_group_id();
delimiter d//
CREATE FUNCTION dc_dolphin_T_t_ds_command_D_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_command'
AND COLUMN_NAME ='worker_group_id')
THEN
ALTER TABLE t_ds_command DROP COLUMN worker_group_id;
END IF;
END;
$$ LANGUAGE plpgsql;
d//
delimiter ;
select dc_dolphin_T_t_ds_command_D_worker_group_id();
DROP FUNCTION dc_dolphin_T_t_ds_command_D_worker_group_id();
-- ac_dolphin_T_t_ds_error_command_A_worker_group
delimiter ;
DROP FUNCTION IF EXISTS ac_dolphin_T_t_ds_error_command_A_worker_group();
delimiter d//
CREATE FUNCTION ac_dolphin_T_t_ds_error_command_A_worker_group() 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_error_command'
AND COLUMN_NAME ='worker_group')
THEN
ALTER TABLE t_ds_error_command ADD COLUMN worker_group varchar(64) DEFAULT null;
END IF; END IF;
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
d// d//
delimiter ; delimiter ;
select ac_dolphin_T_t_ds_error_command_A_worker_group(); select uc_dolphin_T_t_ds_command_R_worker_group_id();
DROP FUNCTION ac_dolphin_T_t_ds_error_command_A_worker_group(); DROP FUNCTION uc_dolphin_T_t_ds_command_R_worker_group_id();
-- dc_dolphin_T_t_ds_error_command_D_worker_group_id -- uc_dolphin_T_t_ds_error_command_R_worker_group_id
delimiter ; delimiter ;
DROP FUNCTION IF EXISTS dc_dolphin_T_t_ds_error_command_D_worker_group_id(); DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_error_command_R_worker_group_id();
delimiter d// delimiter d//
CREATE FUNCTION dc_dolphin_T_t_ds_error_command_D_worker_group_id() RETURNS void AS $$ CREATE FUNCTION uc_dolphin_T_t_ds_error_command_R_worker_group_id() RETURNS void AS $$
BEGIN BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_CATALOG=current_database() WHERE TABLE_CATALOG=current_database()
@ -354,14 +253,15 @@ BEGIN
AND TABLE_NAME='t_ds_error_command' AND TABLE_NAME='t_ds_error_command'
AND COLUMN_NAME ='worker_group_id') AND COLUMN_NAME ='worker_group_id')
THEN THEN
ALTER TABLE t_ds_error_command DROP COLUMN worker_group_id; 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 IF;
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
d// d//
delimiter ; delimiter ;
select dc_dolphin_T_t_ds_error_command_D_worker_group_id(); select uc_dolphin_T_t_ds_error_command_R_worker_group_id();
DROP FUNCTION dc_dolphin_T_t_ds_error_command_D_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 -- uc_dolphin_T_t_ds_process_definition_A_process_definition_unique

5
sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_dml.sql

@ -17,3 +17,8 @@
UPDATE t_ds_resources SET pid=-1,is_directory=false WHERE pid IS NULL; 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 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 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');
Loading…
Cancel
Save