diff --git a/sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql b/sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql index 5312d895c8..61cbfed4fe 100644 --- a/sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql +++ b/sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql @@ -364,3 +364,22 @@ select dc_dolphin_T_t_ds_error_command_D_worker_group_id(); DROP FUNCTION dc_dolphin_T_t_ds_error_command_D_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 information_schema.STATISTICS + WHERE TABLE_NAME='t_ds_process_definition' + AND INDEX_NAME ='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(); + +