@ -23,14 +23,17 @@ CREATE OR REPLACE FUNCTION public.dolphin_update_metadata(
VOLATILEPARALLELUNSAFE
AS$BODY$
DECLARE
v_schemavarchar;
v_schemavarchar;
BEGIN
---getschemaname
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';
return'Success!';
exceptionwhenothersthen
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")';
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';
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")';
-- ALTER TABLE `t_ds_process_task_relation_log` ADD KEY `idx_process_code_version` (`process_definition_code`,`process_definition_version`) USING BTREE;
EXECUTE'DROP INDEX IF EXISTS "process_task_relation_idx_project_code_process_definition_code"';
EXECUTE'CREATE INDEX IF NOT EXISTS process_task_relation_idx_project_code_process_definition_code ON '||quote_ident(v_schema)||'.t_ds_process_task_relation USING Btree("project_code","process_definition_code")';
EXECUTE'DROP INDEX IF EXISTS "process_task_relation_idx_pre_task_code_version"';
EXECUTE'CREATE INDEX IF NOT EXISTS process_task_relation_idx_pre_task_code_version ON '||quote_ident(v_schema)||'.t_ds_process_task_relation USING Btree("pre_task_code","pre_task_version")';
EXECUTE'DROP INDEX IF EXISTS "process_task_relation_idx_post_task_code_version"';
EXECUTE'CREATE INDEX IF NOT EXISTS process_task_relation_idx_post_task_code_version ON '||quote_ident(v_schema)||'.t_ds_process_task_relation USING Btree("post_task_code","post_task_version")';
EXECUTE'DROP INDEX IF EXISTS "process_task_relation_log_idx_project_code_process_definition_code"';
EXECUTE'CREATE INDEX IF NOT EXISTS process_task_relation_log_idx_project_code_process_definition_code ON '||quote_ident(v_schema)||'.t_ds_process_task_relation_log USING Btree("project_code","process_definition_code")';
EXECUTE'DROP INDEX IF EXISTS "idx_task_definition_log_code_version"';
EXECUTE'CREATE INDEX IF NOT EXISTS idx_task_definition_log_code_version ON '||quote_ident(v_schema)||'.t_ds_task_definition_log USING Btree("code","version")';
EXECUTE'ALTER TABLE '||quote_ident(v_schema)||'.t_ds_user ADD COLUMN IF NOT EXISTS "time_zone" varchar(32) DEFAULT NULL';
EXECUTE'ALTER TABLE '||quote_ident(v_schema)||'.t_ds_alert ADD COLUMN IF NOT EXISTS "warning_type" int DEFAULT 2';
EXECUTE'CREATE TABLE IF NOT EXISTS'||quote_ident(v_schema)||'."t_ds_dq_comparison_type" (
--- Drop table: Some table forget delete in the past, should be delete in version 1.2.0
EXECUTE'CREATE INDEX IF NOT EXISTS idx_alert_status ON '||quote_ident(v_schema)||'.t_ds_alert USING Btree("alert_status")';
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")';
EXECUTE'CREATE TABLE IF NOT EXISTS '||quote_ident(v_schema)||'."t_ds_k8s" (
);
CREATETABLEIFNOTEXISTS"t_ds_k8s"(
idserialNOTNULL,
k8s_nameVARCHAR(100)DEFAULTNULL,
k8s_configtext,
create_timetimestampDEFAULTNULL,
update_timetimestampDEFAULTNULL,
PRIMARYKEY(id)
)';
EXECUTE'CREATE TABLE IF NOT EXISTS '||quote_ident(v_schema)||'."t_ds_k8s_namespace" (
);
CREATETABLEIFNOTEXISTS"t_ds_k8s_namespace"(
idserialNOTNULL,
limits_memoryintDEFAULTNULL,
namespacevarchar(100)DEFAULTNULL,
online_job_numintDEFAULTNULL,
online_job_numintDEFAULT'0',
user_idintDEFAULTNULL,
pod_replicasintDEFAULTNULL,
pod_request_cpuNUMERIC(13,4)NULL,
@ -240,9 +192,8 @@ EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_k8s_name