diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java index 4fdafa46fa..6727ccd894 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java @@ -782,6 +782,13 @@ public class ProcessDefinitionService extends BaseDAGService { processDefinitionName, 1); } + // unique check + result = verifyProcessDefinitionName(loginUser, currentProjectName, processDefinitionName); + Status status = (Status) result.get(Constants.STATUS); + if (!Status.SUCCESS.equals(status)) { + return false; + } + // get create process result Map createProcessResult = getCreateProcessResult(loginUser, diff --git a/sql/dolphinscheduler_mysql.sql b/sql/dolphinscheduler_mysql.sql index c0c81dcb21..8ff2667f5f 100644 --- a/sql/dolphinscheduler_mysql.sql +++ b/sql/dolphinscheduler_mysql.sql @@ -415,6 +415,7 @@ CREATE TABLE `t_ds_process_definition` ( `modify_by` varchar(255) DEFAULT NULL, `resource_ids` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), + UNIQUE KEY `process_definition_unique` (`name`,`project_id`), KEY `process_definition_index` (`project_id`,`id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;