Skip to content

Commit 43a27e1

Browse files
authored
[Fix-17142] Add UK uniq_workflow_definition_code on t_ds_workflow_definition (#17151)
1 parent 87f6b2f commit 43a27e1

File tree

7 files changed

+75
-3
lines changed

7 files changed

+75
-3
lines changed

dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ CREATE TABLE t_ds_workflow_definition
423423
update_time datetime DEFAULT NULL,
424424
PRIMARY KEY (id),
425425
UNIQUE KEY workflow_unique (name,project_code) USING BTREE,
426-
UNIQUE KEY code_unique (code)
426+
UNIQUE KEY uniq_workflow_definition_code (code)
427427
);
428428

429429
-- ----------------------------

dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,9 @@ CREATE TABLE `t_ds_workflow_definition` (
426426
`execution_type` tinyint(4) DEFAULT '0' COMMENT 'execution_type 0:parallel,1:serial wait,2:serial discard,3:serial priority',
427427
`create_time` datetime NOT NULL COMMENT 'create time',
428428
`update_time` datetime NOT NULL COMMENT 'update time',
429-
PRIMARY KEY (`id`,`code`),
429+
PRIMARY KEY (`id`),
430430
UNIQUE KEY `workflow_unique` (`name`,`project_code`) USING BTREE,
431+
UNIQUE KEY uniq_workflow_definition_code (code),
431432
KEY `idx_project_code` (`project_code`) USING BTREE
432433
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
433434

dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ CREATE TABLE t_ds_workflow_definition (
349349
CONSTRAINT workflow_definition_unique UNIQUE (name, project_code)
350350
) ;
351351

352-
create index workflow_definition_index on t_ds_workflow_definition (code,id);
352+
create unique index uniq_workflow_definition_code on t_ds_workflow_definition (code);
353353
create index workflow_definition_index_project_code on t_ds_workflow_definition (project_code);
354354

355355
--
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
ALTER TABLE t_ds_workflow_definition DROP PRIMARY KEY;
19+
ALTER TABLE t_ds_workflow_definition ADD PRIMARY KEY(id);
20+
ALTER TABLE t_ds_workflow_definition ADD UNIQUE KEY uniq_workflow_definition_code (code);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
drop index if exists workflow_definition_index;
19+
create unique index uniq_workflow_definition_code on t_ds_workflow_definition (code);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/

0 commit comments

Comments
 (0)