提交更新
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
SET @schema_name = DATABASE();
|
||||
|
||||
SET @idx_file_result_patrol_history_exists := (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.STATISTICS
|
||||
WHERE TABLE_SCHEMA = @schema_name
|
||||
AND TABLE_NAME = 'biz_file_result'
|
||||
AND INDEX_NAME = 'idx_file_result_patrol_history'
|
||||
);
|
||||
|
||||
SET @sql_add_file_result_patrol_history_idx := IF(
|
||||
@idx_file_result_patrol_history_exists = 0,
|
||||
'ALTER TABLE biz_file_result ADD INDEX idx_file_result_patrol_history (module_type, user_id, created_at, id)',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE stmt_add_file_result_patrol_history_idx FROM @sql_add_file_result_patrol_history_idx;
|
||||
EXECUTE stmt_add_file_result_patrol_history_idx;
|
||||
DEALLOCATE PREPARE stmt_add_file_result_patrol_history_idx;
|
||||
|
||||
SET @idx_file_task_patrol_history_exists := (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.STATISTICS
|
||||
WHERE TABLE_SCHEMA = @schema_name
|
||||
AND TABLE_NAME = 'biz_file_task'
|
||||
AND INDEX_NAME = 'idx_file_task_patrol_history'
|
||||
);
|
||||
|
||||
SET @sql_add_file_task_patrol_history_idx := IF(
|
||||
@idx_file_task_patrol_history_exists = 0,
|
||||
'ALTER TABLE biz_file_task ADD INDEX idx_file_task_patrol_history (module_type, id, status, finished_at)',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE stmt_add_file_task_patrol_history_idx FROM @sql_add_file_task_patrol_history_idx;
|
||||
EXECUTE stmt_add_file_task_patrol_history_idx;
|
||||
DEALLOCATE PREPARE stmt_add_file_task_patrol_history_idx;
|
||||
Reference in New Issue
Block a user