Skip to content

Commit

Permalink
[Fix] [Bug] Change default version of Workflow/TaskDefinition to 1 (
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkfloyds authored Jan 26, 2024
1 parent 419cb49 commit e20e066
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ CREATE TABLE t_ds_process_definition
id int(11) NOT NULL AUTO_INCREMENT,
code bigint(20) NOT NULL,
name varchar(255) DEFAULT NULL,
version int(11) DEFAULT NULL,
version int(11) NOT NULL DEFAULT 1,
description text,
project_code bigint(20) NOT NULL,
release_state tinyint(4) DEFAULT NULL,
Expand Down Expand Up @@ -443,7 +443,7 @@ CREATE TABLE t_ds_process_definition_log
id int(11) NOT NULL AUTO_INCREMENT,
code bigint(20) NOT NULL,
name varchar(255) DEFAULT NULL,
version int(11) DEFAULT NULL,
version int(11) NOT NULL DEFAULT '1',
description text,
project_code bigint(20) NOT NULL,
release_state tinyint(4) DEFAULT NULL,
Expand Down Expand Up @@ -471,7 +471,7 @@ CREATE TABLE t_ds_task_definition
id int(11) NOT NULL AUTO_INCREMENT,
code bigint(20) NOT NULL,
name varchar(255) DEFAULT NULL,
version int(11) DEFAULT NULL,
version int(11) NOT NULL DEFAULT '1',
description text,
project_code bigint(20) NOT NULL,
user_id int(11) DEFAULT NULL,
Expand Down Expand Up @@ -508,7 +508,7 @@ CREATE TABLE t_ds_task_definition_log
id int(11) NOT NULL AUTO_INCREMENT,
code bigint(20) NOT NULL,
name varchar(255) DEFAULT NULL,
version int(11) DEFAULT NULL,
version int(11) NOT NULL DEFAULT '1',
description text,
project_code bigint(20) NOT NULL,
user_id int(11) DEFAULT NULL,
Expand Down Expand Up @@ -592,7 +592,7 @@ CREATE TABLE t_ds_process_instance
(
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(255) DEFAULT NULL,
process_definition_version int(11) DEFAULT NULL,
process_definition_version int(11) NOT NULL DEFAULT '1',
process_definition_code bigint(20) not NULL,
project_code bigint(20) DEFAULT NULL,
state tinyint(4) DEFAULT NULL,
Expand Down Expand Up @@ -901,7 +901,7 @@ CREATE TABLE t_ds_task_instance
task_type varchar(50) NOT NULL,
task_execute_type int(11) DEFAULT '0',
task_code bigint(20) NOT NULL,
task_definition_version int(11) DEFAULT NULL,
task_definition_version int(11) NOT NULL DEFAULT '1',
process_instance_id int(11) DEFAULT NULL,
process_instance_name varchar(255) DEFAULT NULL,
project_code bigint(20) DEFAULT NULL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ CREATE TABLE `t_ds_process_definition` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id',
`code` bigint(20) NOT NULL COMMENT 'encoding',
`name` varchar(255) DEFAULT NULL COMMENT 'process definition name',
`version` int(11) DEFAULT '0' COMMENT 'process definition version',
`version` int(11) NOT NULL DEFAULT '1' COMMENT 'process definition version',
`description` text COMMENT 'description',
`project_code` bigint(20) NOT NULL COMMENT 'project code',
`release_state` tinyint(4) DEFAULT NULL COMMENT 'process definition release state:0:offline,1:online',
Expand Down Expand Up @@ -444,7 +444,7 @@ CREATE TABLE `t_ds_process_definition_log` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id',
`code` bigint(20) NOT NULL COMMENT 'encoding',
`name` varchar(255) DEFAULT NULL COMMENT 'process definition name',
`version` int(11) DEFAULT '0' COMMENT 'process definition version',
`version` int(11) NOT NULL DEFAULT '1' COMMENT 'process definition version',
`description` text COMMENT 'description',
`project_code` bigint(20) NOT NULL COMMENT 'project code',
`release_state` tinyint(4) DEFAULT NULL COMMENT 'process definition release state:0:offline,1:online',
Expand All @@ -471,7 +471,7 @@ CREATE TABLE `t_ds_task_definition` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id',
`code` bigint(20) NOT NULL COMMENT 'encoding',
`name` varchar(255) DEFAULT NULL COMMENT 'task definition name',
`version` int(11) DEFAULT '0' COMMENT 'task definition version',
`version` int(11) NOT NULL DEFAULT '1' COMMENT 'task definition version',
`description` text COMMENT 'description',
`project_code` bigint(20) NOT NULL COMMENT 'project code',
`user_id` int(11) DEFAULT NULL COMMENT 'task definition creator id',
Expand Down Expand Up @@ -507,7 +507,7 @@ CREATE TABLE `t_ds_task_definition_log` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'self-increasing id',
`code` bigint(20) NOT NULL COMMENT 'encoding',
`name` varchar(255) DEFAULT NULL COMMENT 'task definition name',
`version` int(11) DEFAULT '0' COMMENT 'task definition version',
`version` int(11) NOT NULL DEFAULT '1' COMMENT 'task definition version',
`description` text COMMENT 'description',
`project_code` bigint(20) NOT NULL COMMENT 'project code',
`user_id` int(11) DEFAULT NULL COMMENT 'task definition creator id',
Expand Down Expand Up @@ -595,7 +595,7 @@ CREATE TABLE `t_ds_process_instance` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key',
`name` varchar(255) DEFAULT NULL COMMENT 'process instance name',
`process_definition_code` bigint(20) NOT NULL COMMENT 'process definition code',
`process_definition_version` int(11) DEFAULT '0' COMMENT 'process definition version',
`process_definition_version` int(11) NOT NULL DEFAULT '1' COMMENT 'process definition version',
`project_code` bigint(20) DEFAULT NULL COMMENT 'project code',
`state` tinyint(4) DEFAULT NULL COMMENT 'process instance Status: 0 commit succeeded, 1 running, 2 prepare to pause, 3 pause, 4 prepare to stop, 5 stop, 6 fail, 7 succeed, 8 need fault tolerance, 9 kill, 10 wait for thread, 11 wait for dependency to complete',
`state_history` text DEFAULT NULL COMMENT 'state history desc',
Expand Down Expand Up @@ -894,7 +894,7 @@ CREATE TABLE `t_ds_task_instance` (
`task_type` varchar(50) NOT NULL COMMENT 'task type',
`task_execute_type` int(11) DEFAULT '0' COMMENT 'task execute type: 0-batch, 1-stream',
`task_code` bigint(20) NOT NULL COMMENT 'task definition code',
`task_definition_version` int(11) DEFAULT '0' COMMENT 'task definition version',
`task_definition_version` int(11) NOT NULL DEFAULT '1' COMMENT 'task definition version',
`process_instance_id` int(11) DEFAULT NULL COMMENT 'process instance id',
`process_instance_name` varchar(255) DEFAULT NULL COMMENT 'process instance name',
`project_code` bigint(20) DEFAULT NULL COMMENT 'project code',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ CREATE TABLE t_ds_process_definition (
id int NOT NULL ,
code bigint NOT NULL,
name varchar(255) DEFAULT NULL ,
version int NOT NULL ,
version int NOT NULL DEFAULT 1,
description text ,
project_code bigint DEFAULT NULL ,
release_state int DEFAULT NULL ,
Expand Down Expand Up @@ -360,7 +360,7 @@ CREATE TABLE t_ds_process_definition_log (
id int NOT NULL ,
code bigint NOT NULL,
name varchar(255) DEFAULT NULL ,
version int NOT NULL ,
version int NOT NULL DEFAULT '1',
description text ,
project_code bigint DEFAULT NULL ,
release_state int DEFAULT NULL ,
Expand Down Expand Up @@ -389,7 +389,7 @@ CREATE TABLE t_ds_task_definition (
id int NOT NULL ,
code bigint NOT NULL,
name varchar(255) DEFAULT NULL ,
version int NOT NULL ,
version int NOT NULL DEFAULT '1',
description text ,
project_code bigint DEFAULT NULL ,
user_id int DEFAULT NULL ,
Expand Down Expand Up @@ -428,7 +428,7 @@ CREATE TABLE t_ds_task_definition_log (
id int NOT NULL ,
code bigint NOT NULL,
name varchar(255) DEFAULT NULL ,
version int NOT NULL ,
version int NOT NULL DEFAULT '1',
description text ,
project_code bigint DEFAULT NULL ,
user_id int DEFAULT NULL ,
Expand Down Expand Up @@ -522,7 +522,7 @@ CREATE TABLE t_ds_process_instance (
id int NOT NULL ,
name varchar(255) DEFAULT NULL ,
process_definition_code bigint DEFAULT NULL ,
process_definition_version int DEFAULT NULL ,
process_definition_version int NOT NULL DEFAULT 1 ,
project_code bigint DEFAULT NULL ,
state int DEFAULT NULL ,
state_history text,
Expand Down Expand Up @@ -795,7 +795,7 @@ CREATE TABLE t_ds_task_instance (
task_type varchar(50) DEFAULT NULL ,
task_execute_type int DEFAULT '0',
task_code bigint NOT NULL,
task_definition_version int DEFAULT NULL ,
task_definition_version int NOT NULL DEFAULT '1' ,
process_instance_id int DEFAULT NULL ,
process_instance_name varchar(255) DEFAULT NULL,
project_code bigint DEFAULT NULL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ alter table t_ds_process_instance drop dependence_schedule_times;

-- t_ds_task_instance note: Data migration is not supported
alter table t_ds_task_instance change process_definition_id task_code bigint(20) NOT NULL COMMENT 'task definition code';
alter table t_ds_task_instance add task_definition_version int(11) DEFAULT '0' COMMENT 'task definition version' AFTER task_code;
alter table t_ds_task_instance add task_definition_version int(11) DEFAULT '1' COMMENT 'task definition version' AFTER task_code;
alter table t_ds_task_instance add task_params text COMMENT 'job custom parameters' AFTER app_link;
alter table t_ds_task_instance add environment_code bigint(20) DEFAULT '-1' COMMENT 'environment code' AFTER worker_group;
alter table t_ds_task_instance add environment_config text COMMENT 'this config contains many environment variables config' AFTER environment_code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ BEGIN
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "var_pool" text';
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "dry_run" int DEFAULT 0';
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "next_process_instance_id" int DEFAULT 0';
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "task_definition_version" int DEFAULT 0';
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "task_definition_version" int DEFAULT 1';
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "task_params" text';
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "environment_code" bigint DEFAULT -1';
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "environment_config" text';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,11 @@ delimiter ;
CALL drop_t_ds_k8s_namespace_col_pod_request_memory;
DROP PROCEDURE drop_t_ds_k8s_namespace_col_pod_request_memory;

ALTER TABLE `t_ds_project_parameter` MODIFY COLUMN `param_value` text NOT NULL COMMENT 'project parameter value';
ALTER TABLE `t_ds_project_parameter` MODIFY COLUMN `param_value` text NOT NULL COMMENT 'project parameter value';

ALTER TABLE `t_ds_process_definition` MODIFY COLUMN `version` int NOT NULL DEFAULT 1 COMMENT "process definition version";
ALTER TABLE `t_ds_process_definition_log` MODIFY COLUMN `version` int NOT NULL DEFAULT 1 COMMENT "process definition version";
ALTER TABLE `t_ds_process_instance` MODIFY COLUMN `process_definition_version` int NOT NULL DEFAULT 1 COMMENT "process definition version";
ALTER TABLE `t_ds_task_definition` MODIFY COLUMN `version` int NOT NULL DEFAULT 1 COMMENT "task definition version";
ALTER TABLE `t_ds_task_definition_log` MODIFY COLUMN `version` int NOT NULL DEFAULT 1 COMMENT "task definition version";
ALTER TABLE `t_ds_task_instance` MODIFY COLUMN `task_definition_version` int NOT NULL DEFAULT 1 COMMENT "task definition version";
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ ALTER TABLE "t_ds_k8s_namespace" DROP COLUMN IF EXISTS "pod_replicas";
ALTER TABLE "t_ds_k8s_namespace" DROP COLUMN IF EXISTS "pod_request_cpu";
ALTER TABLE "t_ds_k8s_namespace" DROP COLUMN IF EXISTS "pod_request_memory";

ALTER TABLE t_ds_project_parameter ALTER COLUMN param_value TYPE text;
ALTER TABLE t_ds_project_parameter ALTER COLUMN param_value TYPE text;

ALTER TABLE "t_ds_process_definition" ALTER COLUMN "version" SET DEFAULT 1;
ALTER TABLE "t_ds_process_definition_log" ALTER COLUMN "version" SET DEFAULT 1;
ALTER TABLE "t_ds_task_definition" ALTER COLUMN "version" SET DEFAULT 1;
ALTER TABLE "t_ds_task_definition_log" ALTER COLUMN "version" SET DEFAULT 1;
ALTER TABLE "t_ds_process_instance" ALTER COLUMN "process_definition_version" SET NOT NULL, ALTER COLUMN "process_definition_version" SET DEFAULT 1;
ALTER TABLE "t_ds_task_instance" ALTER COLUMN "task_definition_version" SET NOT NULL, ALTER COLUMN "task_definition_version" SET DEFAULT 1;
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,11 @@ END;
d//
delimiter ;
CALL modify_data_value_t_ds_dq_rule_input_entry;
DROP PROCEDURE modify_data_value_t_ds_dq_rule_input_entry;
DROP PROCEDURE modify_data_value_t_ds_dq_rule_input_entry;

ALTER TABLE `t_ds_process_definition` MODIFY COLUMN `version` int NOT NULL DEFAULT 1 COMMENT "process definition version";
ALTER TABLE `t_ds_process_definition_log` MODIFY COLUMN `version` int NOT NULL DEFAULT 1 COMMENT "process definition version";
ALTER TABLE `t_ds_process_instance` MODIFY COLUMN `process_definition_version` int NOT NULL DEFAULT 1 COMMENT "process definition version";
ALTER TABLE `t_ds_task_definition` MODIFY COLUMN `version` int NOT NULL DEFAULT 1 COMMENT "task definition version";
ALTER TABLE `t_ds_task_definition_log` MODIFY COLUMN `version` int NOT NULL DEFAULT 1 COMMENT "task definition version";
ALTER TABLE `t_ds_task_instance` MODIFY COLUMN `task_definition_version` int NOT NULL DEFAULT 1 COMMENT "task definition version";
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,11 @@ $$ LANGUAGE plpgsql;
d//

select modify_data_type_t_ds_dq_rule_input_entry();
DROP FUNCTION IF EXISTS modify_data_type_t_ds_dq_rule_input_entry();
DROP FUNCTION IF EXISTS modify_data_type_t_ds_dq_rule_input_entry();

ALTER TABLE "t_ds_process_definition" ALTER COLUMN "version" SET DEFAULT 1;
ALTER TABLE "t_ds_process_definition_log" ALTER COLUMN "version" SET DEFAULT 1;
ALTER TABLE "t_ds_task_definition" ALTER COLUMN "version" SET DEFAULT 1;
ALTER TABLE "t_ds_task_definition_log" ALTER COLUMN "version" SET DEFAULT 1;
ALTER TABLE "t_ds_process_instance" ALTER COLUMN "process_definition_version" SET NOT NULL, ALTER COLUMN "process_definition_version" SET DEFAULT 1;
ALTER TABLE "t_ds_task_instance" ALTER COLUMN "task_definition_version" SET NOT NULL, ALTER COLUMN "task_definition_version" SET DEFAULT 1;

0 comments on commit e20e066

Please sign in to comment.