Skip to content

Commit

Permalink
merge schema 330 into 321 and change docs (#15582) (#15586)
Browse files Browse the repository at this point in the history
* merge schema 330 into 321 and change docs (#15582)

* Add 3.2.2 schema

* remove post sql
  • Loading branch information
zhongjiajie authored Feb 8, 2024
1 parent 718a01b commit e3bef81
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,74 @@
* limitations under the License.
*/

-- Modify "t_ds_alertgroup" table
ALTER TABLE `t_ds_alertgroup` AUTO_INCREMENT 3;
-- Modify "t_ds_alert_plugin_instance" table
ALTER TABLE `t_ds_alert_plugin_instance`
ADD COLUMN `instance_type` int NOT NULL DEFAULT 0, ADD COLUMN `warning_type` int NOT NULL DEFAULT 3;
-- Create "t_ds_listener_event" table
CREATE TABLE `t_ds_listener_event`
(
`id` int NOT NULL AUTO_INCREMENT COMMENT "key",
`content` text NULL COMMENT "listener event json content",
`sign` char(64) NOT NULL DEFAULT "" COMMENT "sign=sha1(content)",
`post_status` tinyint NOT NULL DEFAULT 0 COMMENT "0:wait running,1:success,2:failed,3:partial success",
`event_type` int NOT NULL COMMENT "listener event type",
`log` text NULL COMMENT "log",
`create_time` datetime NULL COMMENT "create time",
`update_time` datetime NULL COMMENT "update time",
PRIMARY KEY (`id`),
INDEX `idx_sign` (`sign`),
INDEX `idx_status` (`post_status`)
) CHARSET utf8 COLLATE utf8_bin;

-- modify_data_t_ds_dq_rule_input_entry behavior change
--DROP PROCEDURE if EXISTS modify_data_t_ds_dq_rule_input_entry;
DROP PROCEDURE if EXISTS modify_data_t_ds_dq_rule_input_entry;
delimiter d//
CREATE PROCEDURE modify_data_t_ds_dq_rule_input_entry()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_dq_rule_input_entry'
AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='value')
THEN
ALTER TABLE `t_ds_dq_rule_input_entry`
CHANGE COLUMN `value` `data` varchar(255) DEFAULT NULL;
END IF;
END;
d//
delimiter ;
CALL modify_data_t_ds_dq_rule_input_entry;
DROP PROCEDURE modify_data_t_ds_dq_rule_input_entry;

-- modify_data_value_t_ds_dq_rule_input_entry behavior change
--DROP PROCEDURE if EXISTS modify_data_value_t_ds_dq_rule_input_entry;
DROP PROCEDURE if EXISTS modify_data_value_t_ds_dq_rule_input_entry;
delimiter d//
CREATE PROCEDURE modify_data_value_t_ds_dq_rule_input_entry()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_dq_rule_input_entry'
AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='value_type')
THEN
ALTER TABLE `t_ds_dq_rule_input_entry`
CHANGE COLUMN `value_type` `data_type` int(11) DEFAULT NULL;
END IF;
END;
d//
delimiter ;
CALL 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";

-- t_ds_k8s_namespace
-- ALTER TABLE t_ds_k8s_namespace DROP COLUMN IF EXISTS limits_cpu;
drop PROCEDURE if EXISTS drop_t_ds_k8s_namespace_col_limits_cpu;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

INSERT IGNORE INTO `t_ds_alertgroup`(alert_instance_ids, create_user_id, group_name, description, create_time, update_time)
VALUES (NULL, 1, 'global alert group', 'global alert group', current_timestamp, current_timestamp);
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,54 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-- Modify "t_ds_alert_plugin_instance" table
ALTER TABLE "t_ds_alert_plugin_instance" ADD COLUMN "instance_type" integer NOT NULL DEFAULT 0, ADD COLUMN "warning_type" integer NOT NULL DEFAULT 3;
-- Create "t_ds_listener_event" table
CREATE TABLE "t_ds_listener_event" ("id" integer NOT NULL, "content" text NULL, "sign" character varying(64) NOT NULL DEFAULT '', "post_status" integer NOT NULL DEFAULT 0, "event_type" integer NOT NULL, "log" text NULL, "create_time" timestamp NULL, "update_time" timestamp NULL, PRIMARY KEY ("id"));
-- Create index "idx_listener_event_post_status" to table: "t_ds_listener_event"
CREATE INDEX "idx_listener_event_post_status" ON "t_ds_listener_event" ("post_status");
-- Create index "idx_listener_event_sign" to table: "t_ds_listener_event"
CREATE INDEX "idx_listener_event_sign" ON "t_ds_listener_event" ("sign");
-- Set comment to column: "sign" on table: "t_ds_listener_event"
COMMENT ON COLUMN "t_ds_listener_event" ."sign" IS 'sign=sha1(content)';
-- modify_data_t_ds_dq_rule_input_entry

delimiter d//
CREATE OR REPLACE FUNCTION modify_data_t_ds_dq_rule_input_entry() RETURNS void AS $$
BEGIN
IF EXISTS (SELECT 1
FROM information_schema.columns
WHERE table_name = 't_ds_dq_rule_input_entry'
AND column_name = 'value')
THEN
ALTER TABLE t_ds_dq_rule_input_entry
RENAME COLUMN "value" TO "data";
END IF;
END;
$$ LANGUAGE plpgsql;
d//

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

-- modify_data_type_t_ds_dq_rule_input_entry
delimiter d//
CREATE OR REPLACE FUNCTION modify_data_type_t_ds_dq_rule_input_entry() RETURNS void AS $$
BEGIN
IF EXISTS (SELECT 1
FROM information_schema.columns
WHERE table_name = 't_ds_dq_rule_input_entry'
AND column_name = 'value_type')
THEN
ALTER TABLE t_ds_dq_rule_input_entry
RENAME COLUMN "value_type" TO "data_type";
END IF;
END;
$$ 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();

-- t_ds_k8s_namespace
ALTER TABLE "t_ds_k8s_namespace" DROP COLUMN IF EXISTS "limits_cpu";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
INSERT INTO t_ds_alertgroup(alert_instance_ids, create_user_id, group_name, description, create_time, update_time)
VALUES (NULL, 1, 'global alert group', 'global alert group', '2018-11-29 10:20:39', '2018-11-29 10:20:39');
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
INSERT IGNORE INTO `t_ds_alertgroup`(alert_instance_ids, create_user_id, group_name, description, create_time, update_time)
VALUES (NULL, 1, 'global alert group', 'global alert group', current_timestamp, current_timestamp);
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
INSERT INTO t_ds_alertgroup(alert_instance_ids, create_user_id, group_name, description, create_time, update_time)
VALUES (NULL, 1, 'global alert group', 'global alert group', '2018-11-29 10:20:39', '2018-11-29 10:20:39');

This file was deleted.

This file was deleted.

0 comments on commit e3bef81

Please sign in to comment.