|
|
@ -14,97 +14,9 @@ |
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
* limitations under the License. |
|
|
|
* limitations under the License. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
-- uc_dolphin_T_t_ds_command_R_test_flag |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_command_R_test_flag(); |
|
|
|
|
|
|
|
delimiter d// |
|
|
|
|
|
|
|
CREATE FUNCTION uc_dolphin_T_t_ds_command_R_test_flag() 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 ='test_flag') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_command alter column test_flag type int; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_command alter column test_flag set DEFAULT NULL; |
|
|
|
|
|
|
|
END IF; |
|
|
|
|
|
|
|
END; |
|
|
|
|
|
|
|
$$ LANGUAGE plpgsql; |
|
|
|
|
|
|
|
d// |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
select uc_dolphin_T_t_ds_command_R_test_flag(); |
|
|
|
|
|
|
|
DROP FUNCTION uc_dolphin_T_t_ds_command_R_test_flag(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- uc_dolphin_T_t_ds_error_command_R_test_flag |
|
|
|
-- create table |
|
|
|
delimiter ; |
|
|
|
CREATE TABLE IF NOT EXISTS t_ds_trigger_relation ( |
|
|
|
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_error_command_R_test_flag(); |
|
|
|
|
|
|
|
delimiter d// |
|
|
|
|
|
|
|
CREATE FUNCTION uc_dolphin_T_t_ds_error_command_R_test_flag() 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 ='test_flag') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_error_command alter column test_flag type int; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_error_command alter column test_flag set DEFAULT NULL; |
|
|
|
|
|
|
|
END IF; |
|
|
|
|
|
|
|
END; |
|
|
|
|
|
|
|
$$ LANGUAGE plpgsql; |
|
|
|
|
|
|
|
d// |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
select uc_dolphin_T_t_ds_error_command_R_test_flag(); |
|
|
|
|
|
|
|
DROP FUNCTION uc_dolphin_T_t_ds_error_command_R_test_flag(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- uc_dolphin_T_t_ds_process_instance_R_test_flag |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_process_instance_R_test_flag(); |
|
|
|
|
|
|
|
delimiter d// |
|
|
|
|
|
|
|
CREATE FUNCTION uc_dolphin_T_t_ds_process_instance_R_test_flag() 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 ='test_flag') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance alter column test_flag type int; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance alter column test_flag set DEFAULT NULL; |
|
|
|
|
|
|
|
END IF; |
|
|
|
|
|
|
|
END; |
|
|
|
|
|
|
|
$$ LANGUAGE plpgsql; |
|
|
|
|
|
|
|
d// |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
select uc_dolphin_T_t_ds_process_instance_R_test_flag(); |
|
|
|
|
|
|
|
DROP FUNCTION uc_dolphin_T_t_ds_process_instance_R_test_flag(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- uc_dolphin_T_t_ds_task_instance_R_test_flag |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_task_instance_R_test_flag(); |
|
|
|
|
|
|
|
delimiter d// |
|
|
|
|
|
|
|
CREATE FUNCTION uc_dolphin_T_t_ds_task_instance_R_test_flag() 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 ='test_flag') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance alter column test_flag type int; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance alter column test_flag set DEFAULT NULL; |
|
|
|
|
|
|
|
END IF; |
|
|
|
|
|
|
|
END; |
|
|
|
|
|
|
|
$$ LANGUAGE plpgsql; |
|
|
|
|
|
|
|
d// |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
select uc_dolphin_T_t_ds_task_instance_R_test_flag(); |
|
|
|
|
|
|
|
DROP FUNCTION uc_dolphin_T_t_ds_task_instance_R_test_flag(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delimiter d// |
|
|
|
|
|
|
|
DROP TABLE IF EXISTS t_ds_trigger_relation; |
|
|
|
|
|
|
|
CREATE TABLE t_ds_trigger_relation ( |
|
|
|
|
|
|
|
id serial NOT NULL, |
|
|
|
id serial NOT NULL, |
|
|
|
trigger_type int NOT NULL, |
|
|
|
trigger_type int NOT NULL, |
|
|
|
trigger_code bigint NOT NULL, |
|
|
|
trigger_code bigint NOT NULL, |
|
|
@ -114,204 +26,145 @@ CREATE TABLE t_ds_trigger_relation ( |
|
|
|
PRIMARY KEY (id), |
|
|
|
PRIMARY KEY (id), |
|
|
|
CONSTRAINT t_ds_trigger_relation_unique UNIQUE (trigger_type,job_id,trigger_code) |
|
|
|
CONSTRAINT t_ds_trigger_relation_unique UNIQUE (trigger_type,job_id,trigger_code) |
|
|
|
); |
|
|
|
); |
|
|
|
d// |
|
|
|
CREATE TABLE IF NOT EXISTS t_ds_relation_sub_workflow ( |
|
|
|
delimiter ; |
|
|
|
id serial NOT NULL, |
|
|
|
|
|
|
|
parent_workflow_instance_id BIGINT NOT NULL, |
|
|
|
|
|
|
|
parent_task_code BIGINT NOT NULL, |
|
|
|
|
|
|
|
sub_workflow_instance_id BIGINT NOT NULL, |
|
|
|
|
|
|
|
PRIMARY KEY (id) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
CREATE TABLE if not exists "t_ds_fav_task" ( |
|
|
|
|
|
|
|
"id" serial NOT NULL, |
|
|
|
|
|
|
|
"task_type" VARCHAR(64) NOT NULL, |
|
|
|
|
|
|
|
"user_id" integer NOT NULL, |
|
|
|
|
|
|
|
PRIMARY KEY ("id") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
CREATE TABLE if not exists "t_ds_project_preference" ( |
|
|
|
|
|
|
|
"id" int NOT NULL, |
|
|
|
|
|
|
|
"code" bigint NOT NULL, |
|
|
|
|
|
|
|
"project_code" bigint NOT NULL, |
|
|
|
|
|
|
|
"preferences" VARCHAR(512) NOT NULL, |
|
|
|
|
|
|
|
"user_id" integer NULL, |
|
|
|
|
|
|
|
"state" integer NULL DEFAULT 1, |
|
|
|
|
|
|
|
"create_time" timestamp NULL DEFAULT CURRENT_TIMESTAMP, |
|
|
|
|
|
|
|
"update_time" timestamp NULL DEFAULT CURRENT_TIMESTAMP, |
|
|
|
|
|
|
|
PRIMARY KEY ("id") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
CREATE TABLE if not exists "t_ds_project_parameter" ( |
|
|
|
|
|
|
|
"id" int NOT NULL, |
|
|
|
|
|
|
|
"param_name" VARCHAR(255) NOT NULL, |
|
|
|
|
|
|
|
"param_value" VARCHAR(255) NOT NULL, |
|
|
|
|
|
|
|
"code" bigint NOT NULL, |
|
|
|
|
|
|
|
"project_code" bigint NOT NULL, |
|
|
|
|
|
|
|
"user_id" integer NULL, |
|
|
|
|
|
|
|
"create_time" timestamp NULL DEFAULT CURRENT_TIMESTAMP, |
|
|
|
|
|
|
|
"update_time" timestamp NULL DEFAULT CURRENT_TIMESTAMP, |
|
|
|
|
|
|
|
PRIMARY KEY ("id") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_definition DROP COLUMN IF EXISTS is_cache; |
|
|
|
-- add column, if you want to add constraint to the new column you should add them first |
|
|
|
ALTER TABLE t_ds_task_definition ADD COLUMN IF NOT EXISTS is_cache int DEFAULT '0'; |
|
|
|
ALTER TABLE t_ds_task_definition ADD COLUMN IF NOT EXISTS is_cache int DEFAULT '0'; |
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_definition_log DROP COLUMN IF EXISTS is_cache; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_definition_log ADD COLUMN IF NOT EXISTS is_cache int DEFAULT '0'; |
|
|
|
ALTER TABLE t_ds_task_definition_log ADD COLUMN IF NOT EXISTS is_cache int DEFAULT '0'; |
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance DROP COLUMN IF EXISTS is_cache; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance ADD COLUMN IF NOT EXISTS is_cache int DEFAULT '0'; |
|
|
|
ALTER TABLE t_ds_task_instance ADD COLUMN IF NOT EXISTS is_cache int DEFAULT '0'; |
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance ADD COLUMN IF NOT EXISTS cache_key varchar(200) DEFAULT NULL; |
|
|
|
ALTER TABLE t_ds_task_instance ADD COLUMN IF NOT EXISTS cache_key varchar(200) DEFAULT NULL; |
|
|
|
ALTER TABLE t_ds_task_instance DROP COLUMN IF EXISTS cacke_key; |
|
|
|
ALTER TABLE t_ds_task_instance ADD COLUMN IF NOT EXISTS process_instance_name varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance ADD COLUMN IF NOT EXISTS executor_name varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance ADD COLUMN IF NOT EXISTS test_flag int; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance ADD COLUMN IF NOT EXISTS project_code int; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance ADD COLUMN IF NOT EXISTS project_code bigint; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance ADD COLUMN IF NOT EXISTS executor_name varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance ADD COLUMN IF NOT EXISTS tenant_code varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance ADD COLUMN IF NOT EXISTS project_code bigint; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance ADD COLUMN IF NOT EXISTS test_flag int; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_command ADD COLUMN IF NOT EXISTS tenant_code varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_command ADD COLUMN IF NOT EXISTS test_flag int; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_error_command ADD COLUMN IF NOT EXISTS tenant_code varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_error_command ADD COLUMN IF NOT EXISTS test_flag int; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_schedules ADD COLUMN IF NOT EXISTS tenant_code varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_alert ADD COLUMN IF NOT EXISTS title varchar(512); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_command ADD COLUMN IF NOT EXISTS worker_group varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_project ADD COLUMN IF NOT EXISTS name varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_schedules ADD COLUMN IF NOT EXISTS worker_group varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance ADD COLUMN IF NOT EXISTS worker_group varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_udfs ADD COLUMN IF NOT EXISTS func_name varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_version ADD COLUMN IF NOT EXISTS version varchar(63); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_plugin_define ADD COLUMN IF NOT EXISTS plugin_name varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_plugin_define ADD COLUMN IF NOT EXISTS plugin_type varchar(63); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_alert_plugin_instance ADD COLUMN IF NOT EXISTS instance_name varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_dq_rule ADD COLUMN IF NOT EXISTS name varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_environment ADD COLUMN IF NOT EXISTS name varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_group_queue ADD COLUMN IF NOT EXISTS task_name VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_group ADD COLUMN IF NOT EXISTS name varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_k8s ADD COLUMN IF NOT EXISTS k8s_name VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_k8s_namespace ADD COLUMN IF NOT EXISTS namespace varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_cluster ADD COLUMN IF NOT EXISTS name varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_fav_task" ADD COLUMN IF NOT EXISTS "task_type" varchar(64) NOT NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- alter column |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_alert" ALTER COLUMN "title" TYPE VARCHAR(512); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_alert_plugin_instance" ALTER COLUMN "instance_name" TYPE VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_cluster" ALTER COLUMN "name" TYPE VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_command" ALTER COLUMN "worker_group" TYPE VARCHAR(255), ALTER COLUMN "tenant_code" SET DEFAULT 'default'; |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_dq_rule" ALTER COLUMN "name" TYPE VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_environment" ALTER COLUMN "name" TYPE VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_error_command" ALTER COLUMN "worker_group" TYPE VARCHAR(255), ALTER COLUMN "tenant_code" SET DEFAULT 'default'; |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_k8s" ALTER COLUMN "k8s_name" TYPE VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_k8s_namespace" ALTER COLUMN "namespace" TYPE VARCHAR(255), ALTER COLUMN "code" DROP DEFAULT, ALTER COLUMN "cluster_code" DROP DEFAULT; |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_plugin_define" ALTER COLUMN "plugin_name" TYPE VARCHAR(255), ALTER COLUMN "plugin_type" TYPE VARCHAR(63); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_process_instance" ALTER COLUMN "worker_group" TYPE VARCHAR(255), ALTER COLUMN "executor_name" SET DEFAULT NULL::VARCHAR, ALTER COLUMN "tenant_code" SET DEFAULT 'default'; |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_project" ALTER COLUMN "name" TYPE VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_schedules" ALTER COLUMN "worker_group" TYPE VARCHAR(255), ALTER COLUMN "tenant_code" SET DEFAULT 'default'; |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_task_group" ALTER COLUMN "name" TYPE VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_task_group_queue" ALTER COLUMN "task_name" TYPE VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_task_instance" ALTER COLUMN "worker_group" TYPE VARCHAR(255), ALTER COLUMN "process_instance_name" SET DEFAULT NULL::VARCHAR, ALTER COLUMN "executor_name" SET DEFAULT NULL::VARCHAR, ALTER COLUMN "project_code" TYPE bigint; |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_udfs" ALTER COLUMN "func_name" TYPE VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_user" ALTER COLUMN "tenant_id" SET DEFAULT -1; |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_version" ALTER COLUMN "version" TYPE VARCHAR(63); |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_worker_group" ALTER COLUMN "description" TYPE text, ALTER COLUMN "description" DROP DEFAULT; |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_error_command" ALTER COLUMN "id" DROP DEFAULT; |
|
|
|
|
|
|
|
ALTER TABLE "t_ds_task_instance" ALTER COLUMN "log_path" DROP DEFAULT; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- create index |
|
|
|
|
|
|
|
DROP INDEX IF EXISTS idx_code; |
|
|
|
|
|
|
|
DROP INDEX IF EXISTS idx_process_code_version; |
|
|
|
|
|
|
|
DROP INDEX IF EXISTS idx_code_version; |
|
|
|
|
|
|
|
-- re index table t_ds_task_definition with index name task_definition_index |
|
|
|
|
|
|
|
DROP INDEX IF EXISTS task_definition_index; |
|
|
|
CREATE INDEX IF NOT EXISTS idx_cache_key ON t_ds_task_instance USING Btree("cache_key"); |
|
|
|
CREATE INDEX IF NOT EXISTS idx_cache_key ON t_ds_task_instance USING Btree("cache_key"); |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_parent_workflow_instance_id ON t_ds_relation_sub_workflow (parent_workflow_instance_id); |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_parent_task_code ON t_ds_relation_sub_workflow (parent_task_code); |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_sub_workflow_instance_id ON t_ds_relation_sub_workflow (sub_workflow_instance_id); |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS task_definition_index ON t_ds_task_definition (project_code, id); |
|
|
|
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS "unique_project_parameter_code" ON "t_ds_project_parameter" ("code"); |
|
|
|
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS "unique_project_parameter_name" ON "t_ds_project_parameter" ("project_code", "param_name"); |
|
|
|
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS "unique_project_preference_code" ON "t_ds_project_preference" ("code"); |
|
|
|
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS "unique_project_preference_project_code" ON "t_ds_project_preference" ("project_code"); |
|
|
|
|
|
|
|
|
|
|
|
-- add_t_ds_process_instance_add_project_code |
|
|
|
-- SEQUENCE |
|
|
|
delimiter ; |
|
|
|
DROP SEQUENCE IF EXISTS t_ds_project_preference_id_sequence; |
|
|
|
DROP FUNCTION IF EXISTS add_t_ds_process_instance_add_project_code(); |
|
|
|
CREATE SEQUENCE t_ds_project_preference_id_sequence; |
|
|
|
delimiter d// |
|
|
|
ALTER TABLE t_ds_project_preference ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_project_preference_id_sequence'); |
|
|
|
CREATE FUNCTION add_t_ds_process_instance_add_project_code() RETURNS void AS $$ |
|
|
|
DROP SEQUENCE IF EXISTS t_ds_project_parameter_id_sequence; |
|
|
|
BEGIN |
|
|
|
CREATE SEQUENCE t_ds_project_parameter_id_sequence; |
|
|
|
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
|
|
|
ALTER TABLE t_ds_project_parameter ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_project_parameter_id_sequence'); |
|
|
|
WHERE TABLE_CATALOG=current_database() |
|
|
|
DROP SEQUENCE IF EXISTS "t_ds_error_command_id_seq"; |
|
|
|
AND TABLE_SCHEMA=current_schema() |
|
|
|
|
|
|
|
AND TABLE_NAME='t_ds_process_instance' |
|
|
|
-- add comment |
|
|
|
AND COLUMN_NAME ='project_code') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance ADD project_code bigint; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance alter column project_code set DEFAULT NULL; |
|
|
|
|
|
|
|
comment on column t_ds_process_instance.project_code is 'project code'; |
|
|
|
comment on column t_ds_process_instance.project_code is 'project code'; |
|
|
|
END IF; |
|
|
|
|
|
|
|
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 ='executor_name') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance ADD executor_name varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance alter column executor_name set DEFAULT NULL; |
|
|
|
|
|
|
|
comment on column t_ds_process_instance.executor_name is 'execute user name'; |
|
|
|
comment on column t_ds_process_instance.executor_name is 'execute user name'; |
|
|
|
END IF; |
|
|
|
|
|
|
|
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 ='tenant_code') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance ADD tenant_code varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance alter column tenant_code set DEFAULT NULL; |
|
|
|
|
|
|
|
comment on column t_ds_process_instance.tenant_code is 'tenant code'; |
|
|
|
comment on column t_ds_process_instance.tenant_code is 'tenant code'; |
|
|
|
END IF; |
|
|
|
|
|
|
|
END; |
|
|
|
|
|
|
|
$$ LANGUAGE plpgsql; |
|
|
|
|
|
|
|
d// |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
select add_t_ds_process_instance_add_project_code(); |
|
|
|
|
|
|
|
DROP FUNCTION add_t_ds_process_instance_add_project_code(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- add_t_ds_process_instance_add_project_code |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
DROP FUNCTION IF EXISTS add_t_ds_task_instance_add_project_code(); |
|
|
|
|
|
|
|
delimiter d// |
|
|
|
|
|
|
|
CREATE FUNCTION add_t_ds_task_instance_add_project_code() 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 ='process_instance_name') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance ADD process_instance_name varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance alter column process_instance_name set DEFAULT NULL; |
|
|
|
|
|
|
|
comment on column t_ds_task_instance.process_instance_name is 'process instance name'; |
|
|
|
comment on column t_ds_task_instance.process_instance_name is 'process instance name'; |
|
|
|
END IF; |
|
|
|
|
|
|
|
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 ='project_code') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance ADD project_code bigint; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_process_instance alter column project_code set DEFAULT NULL; |
|
|
|
|
|
|
|
comment on column t_ds_process_instance.project_code is 'project code'; |
|
|
|
comment on column t_ds_process_instance.project_code is 'project code'; |
|
|
|
END IF; |
|
|
|
|
|
|
|
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 ='executor_name') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance ADD executor_name varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance alter column executor_name set DEFAULT NULL; |
|
|
|
|
|
|
|
comment on column t_ds_task_instance.executor_name is 'execute user name'; |
|
|
|
comment on column t_ds_task_instance.executor_name is 'execute user name'; |
|
|
|
END IF; |
|
|
|
|
|
|
|
END; |
|
|
|
|
|
|
|
$$ LANGUAGE plpgsql; |
|
|
|
|
|
|
|
d// |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
select add_t_ds_task_instance_add_project_code(); |
|
|
|
|
|
|
|
DROP FUNCTION add_t_ds_task_instance_add_project_code(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE t_ds_alert alter column title type varchar(512); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_alert alter column title set DEFAULT NULL; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_command alter column worker_group type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_project alter column name type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_project alter column name set DEFAULT NULL; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_schedules alter column worker_group type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_instance alter column worker_group type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_udfs alter column func_name type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_udfs alter column func_name set NOT NULL ; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_version alter column version type varchar(63); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_version alter column version set NOT NULL; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_plugin_define alter column plugin_name type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_plugin_define alter column plugin_name set NOT NULL; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_plugin_define alter column plugin_type type varchar(63); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_plugin_define alter column plugin_type set NOT NULL; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_alert_plugin_instance alter column instance_name type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_alert_plugin_instance alter column instance_name set DEFAULT NULL; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_dq_rule alter column name type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_dq_rule alter column name set DEFAULT NULL; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_environment alter column name type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_environment alter column name set DEFAULT NULL; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_group_queue alter column task_name type VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_group_queue alter column task_name set DEFAULT NULL ; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_group alter column name type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_task_group alter column name set DEFAULT NULL ; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_k8s alter column k8s_name type VARCHAR(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_k8s alter column k8s_name set DEFAULT NULL ; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_k8s_namespace alter column namespace type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_k8s_namespace alter column namespace set DEFAULT NULL; |
|
|
|
|
|
|
|
ALTER TABLE t_ds_cluster alter column name type varchar(255); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_cluster alter column name set DEFAULT NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- tenant improvement |
|
|
|
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
DROP FUNCTION IF EXISTS add_improvement_workflow_run_tenant(); |
|
|
|
|
|
|
|
delimiter d// |
|
|
|
|
|
|
|
CREATE FUNCTION add_improvement_workflow_run_tenant() 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 ='tenant_code') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_command ADD tenant_code varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_command alter column tenant_code set DEFAULT 'default'; |
|
|
|
|
|
|
|
comment on column t_ds_command.tenant_code is 'tenant code'; |
|
|
|
comment on column t_ds_command.tenant_code is 'tenant code'; |
|
|
|
END IF; |
|
|
|
|
|
|
|
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 ='tenant_code') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_error_command ADD tenant_code varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_error_command alter column tenant_code set DEFAULT 'default'; |
|
|
|
|
|
|
|
comment on column t_ds_error_command.tenant_code is 'tenant code'; |
|
|
|
comment on column t_ds_error_command.tenant_code is 'tenant code'; |
|
|
|
END IF; |
|
|
|
|
|
|
|
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 ='tenant_code') |
|
|
|
|
|
|
|
THEN |
|
|
|
|
|
|
|
ALTER TABLE t_ds_schedules ADD tenant_code varchar(64); |
|
|
|
|
|
|
|
ALTER TABLE t_ds_schedules alter column tenant_code set DEFAULT NULL; |
|
|
|
|
|
|
|
comment on column t_ds_schedules.tenant_code is 'tenant code'; |
|
|
|
comment on column t_ds_schedules.tenant_code is 'tenant code'; |
|
|
|
END IF; |
|
|
|
COMMENT ON COLUMN "t_ds_command" ."tenant_code" IS ''; |
|
|
|
END; |
|
|
|
COMMENT ON COLUMN "t_ds_error_command" ."tenant_code" IS ''; |
|
|
|
$$ LANGUAGE plpgsql; |
|
|
|
COMMENT ON COLUMN "t_ds_process_instance" ."project_code" IS ''; |
|
|
|
d// |
|
|
|
COMMENT ON COLUMN "t_ds_process_instance" ."executor_name" IS ''; |
|
|
|
delimiter ; |
|
|
|
COMMENT ON COLUMN "t_ds_process_instance" ."tenant_code" IS ''; |
|
|
|
select add_improvement_workflow_run_tenant(); |
|
|
|
COMMENT ON COLUMN "t_ds_schedules" ."tenant_code" IS ''; |
|
|
|
DROP FUNCTION add_improvement_workflow_run_tenant(); |
|
|
|
COMMENT ON COLUMN "t_ds_task_instance" ."process_instance_name" IS ''; |
|
|
|
|
|
|
|
COMMENT ON COLUMN "t_ds_task_instance" ."executor_name" IS ''; |
|
|
|
-- uc_dolphin_T_t_ds_relation_sub_workflow |
|
|
|
COMMENT ON COLUMN "t_ds_alert" ."sign" IS 'sign=sha1(content)'; |
|
|
|
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_relation_sub_workflow() |
|
|
|
|
|
|
|
RETURNS VOID AS $$ |
|
|
|
|
|
|
|
BEGIN |
|
|
|
|
|
|
|
IF NOT EXISTS ( |
|
|
|
|
|
|
|
SELECT 1 |
|
|
|
|
|
|
|
FROM information_schema.columns |
|
|
|
|
|
|
|
WHERE table_name='t_ds_relation_sub_workflow' |
|
|
|
|
|
|
|
AND table_schema=current_schema() |
|
|
|
|
|
|
|
) THEN |
|
|
|
|
|
|
|
CREATE TABLE t_ds_relation_sub_workflow ( |
|
|
|
|
|
|
|
id serial NOT NULL, |
|
|
|
|
|
|
|
parent_workflow_instance_id BIGINT NOT NULL, |
|
|
|
|
|
|
|
parent_task_code BIGINT NOT NULL, |
|
|
|
|
|
|
|
sub_workflow_instance_id BIGINT NOT NULL, |
|
|
|
|
|
|
|
PRIMARY KEY (id) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
CREATE INDEX idx_parent_workflow_instance_id ON t_ds_relation_sub_workflow (parent_workflow_instance_id); |
|
|
|
|
|
|
|
CREATE INDEX idx_parent_task_code ON t_ds_relation_sub_workflow (parent_task_code); |
|
|
|
|
|
|
|
CREATE INDEX idx_sub_workflow_instance_id ON t_ds_relation_sub_workflow (sub_workflow_instance_id); |
|
|
|
|
|
|
|
END IF; |
|
|
|
|
|
|
|
END; |
|
|
|
|
|
|
|
$$ LANGUAGE plpgsql; |
|
|
|
|
|
|
|