Browse Source

unique check before import ProcessDefinitions

pull/2/head
张世鸣 5 years ago
parent
commit
82fee46d70
  1. 7
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
  2. 1
      sql/dolphinscheduler_mysql.sql

7
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java

@ -782,6 +782,13 @@ public class ProcessDefinitionService extends BaseDAGService {
processDefinitionName, 1); 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 // get create process result
Map<String, Object> createProcessResult = Map<String, Object> createProcessResult =
getCreateProcessResult(loginUser, getCreateProcessResult(loginUser,

1
sql/dolphinscheduler_mysql.sql

@ -415,6 +415,7 @@ CREATE TABLE `t_ds_process_definition` (
`modify_by` varchar(255) DEFAULT NULL, `modify_by` varchar(255) DEFAULT NULL,
`resource_ids` varchar(255) DEFAULT NULL, `resource_ids` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `process_definition_unique` (`name`,`project_id`),
KEY `process_definition_index` (`project_id`,`id`) USING BTREE KEY `process_definition_index` (`project_id`,`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

Loading…
Cancel
Save