Skip to content

Commit 7c73e3f

Browse files
committed
fix: Missing ddl in 2.0.x
related: #13901
1 parent 339881a commit 7c73e3f

File tree

4 files changed

+147
-0
lines changed

4 files changed

+147
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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 PROCEDURE if EXISTS t_ds_process_definition_add_column;
19+
delimiter d//
20+
CREATE PROCEDURE t_ds_process_definition_add_column()
21+
BEGIN
22+
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
23+
WHERE TABLE_NAME='t_ds_process_definition'
24+
AND TABLE_SCHEMA=(SELECT DATABASE())
25+
AND COLUMN_NAME='execution_type')
26+
THEN
27+
ALTER TABLE t_ds_process_definition ADD COLUMN `execution_type` tinyint(4) DEFAULT '0' COMMENT 'execution_type 0:parallel,1:serial wait,2:serial discard,3:serial priority';
28+
END IF;
29+
END;
30+
d//
31+
delimiter ;
32+
CALL t_ds_process_definition_add_column;
33+
DROP PROCEDURE t_ds_process_definition_add_column;
34+
35+
36+
-- t_ds_process_definition_log_add_column
37+
drop PROCEDURE if EXISTS t_ds_process_definition_log_add_column;
38+
delimiter d//
39+
CREATE PROCEDURE t_ds_process_definition_log_add_column()
40+
BEGIN
41+
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
42+
WHERE TABLE_NAME='t_ds_process_definition_log'
43+
AND TABLE_SCHEMA=(SELECT DATABASE())
44+
AND COLUMN_NAME='execution_type')
45+
THEN
46+
ALTER TABLE t_ds_process_definition_log ADD COLUMN `execution_type` tinyint(4) DEFAULT '0' COMMENT 'execution_type 0:parallel,1:serial wait,2:serial discard,3:serial priority';
47+
END IF;
48+
END;
49+
d//
50+
delimiter ;
51+
CALL t_ds_process_definition_log_add_column;
52+
DROP PROCEDURE t_ds_process_definition_log_add_column;
53+
54+
55+
-- t_ds_process_instance_add_column
56+
drop PROCEDURE if EXISTS t_ds_process_instance_add_column;
57+
delimiter d//
58+
CREATE PROCEDURE t_ds_process_instance_add_column()
59+
BEGIN
60+
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
61+
WHERE TABLE_NAME='t_ds_process_instance'
62+
AND TABLE_SCHEMA=(SELECT DATABASE())
63+
AND COLUMN_NAME='next_process_instance_id')
64+
THEN
65+
ALTER TABLE t_ds_process_instance ADD COLUMN `next_process_instance_id` int(11) DEFAULT '0' COMMENT 'serial queue next processInstanceId';
66+
END IF;
67+
END;
68+
d//
69+
delimiter ;
70+
CALL t_ds_process_instance_add_column;
71+
DROP PROCEDURE t_ds_process_instance_add_column;
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+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
delimiter d//
18+
CREATE OR REPLACE FUNCTION public.dolphin_update_metadata(
19+
)
20+
RETURNS character varying
21+
LANGUAGE 'plpgsql'
22+
COST 100
23+
VOLATILE PARALLEL UNSAFE
24+
AS $BODY$
25+
DECLARE
26+
v_schema varchar;
27+
BEGIN
28+
---get schema name
29+
v_schema =current_schema();
30+
31+
--- add missing columns, https://github.com/apache/dolphinscheduler/pull/13901
32+
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_definition ADD COLUMN IF NOT EXISTS "execution_type" int DEFAULT 0';
33+
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "next_process_instance_id" int DEFAULT 0';
34+
35+
return 'Success!';
36+
exception when others then
37+
---Raise EXCEPTION '(%)',SQLERRM;
38+
return SQLERRM;
39+
END;
40+
$BODY$;
41+
42+
select dolphin_update_metadata();
43+
44+
d//
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)