|
|
|
@ -15,7 +15,37 @@
|
|
|
|
|
* limitations under the License. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
drop procedure if exists re_add_index; |
|
|
|
|
delimiter d// |
|
|
|
|
create procedure re_add_index(target_table_name varchar(256), |
|
|
|
|
target_index_type varchar(8), target_index_name varchar(256), |
|
|
|
|
target_columns varchar(512), using_str varchar(256)) |
|
|
|
|
begin |
|
|
|
|
declare target_database varchar(256); |
|
|
|
|
select database() into target_database; |
|
|
|
|
IF EXISTS(SELECT * |
|
|
|
|
FROM information_schema.statistics |
|
|
|
|
WHERE table_schema = target_database |
|
|
|
|
AND table_name = target_table_name |
|
|
|
|
AND index_name = target_index_name) THEN |
|
|
|
|
set @statement = concat('drop index ', target_index_name, ' on ', target_table_name); |
|
|
|
|
PREPARE STMT FROM @statement; |
|
|
|
|
EXECUTE STMT; |
|
|
|
|
END IF; |
|
|
|
|
set @statement = |
|
|
|
|
concat('alter table ', target_table_name, ' add ', target_index_type, ' ', target_index_name, |
|
|
|
|
'(', target_columns, |
|
|
|
|
') ', using_str); |
|
|
|
|
PREPARE STMT FROM @statement; |
|
|
|
|
EXECUTE STMT; |
|
|
|
|
end; |
|
|
|
|
d// |
|
|
|
|
delimiter ; |
|
|
|
|
|
|
|
|
|
ALTER TABLE `t_ds_task_instance` MODIFY COLUMN `task_params` longtext COMMENT 'job custom parameters' AFTER `app_link`; |
|
|
|
|
ALTER TABLE `t_ds_process_task_relation` ADD KEY `idx_code` (`project_code`, `process_definition_code`) USING BTREE; |
|
|
|
|
ALTER TABLE `t_ds_process_task_relation_log` ADD KEY `idx_process_code_version` (`process_definition_code`,`process_definition_version`) USING BTREE; |
|
|
|
|
ALTER TABLE `t_ds_task_definition_log` ADD INDEX `idx_code_version` (`code`,`version`) USING BTREE; |
|
|
|
|
|
|
|
|
|
call re_add_index('t_ds_process_task_relation','KEY','idx_code', '`project_code`, `process_definition_code`', 'USING BTREE'); |
|
|
|
|
call re_add_index('t_ds_process_task_relation_log','KEY','idx_process_code_version','`process_definition_code`,`process_definition_version`', 'USING BTREE'); |
|
|
|
|
call re_add_index('t_ds_task_definition_log','INDEX','idx_code_version','`code`,`version`', 'USING BTREE'); |
|
|
|
|
|
|
|
|
|
drop procedure if exists re_add_index; |