diff --git a/support-files/sql/job-execute/0022_job_execute_20230719-1000_V3.7.6_mysql.sql b/support-files/sql/job-execute/0022_job_execute_20230719-1000_V3.7.6_mysql.sql new file mode 100644 index 0000000000..5f29ac194e --- /dev/null +++ b/support-files/sql/job-execute/0022_job_execute_20230719-1000_V3.7.6_mysql.sql @@ -0,0 +1,31 @@ +USE job_execute; + +SET NAMES utf8mb4; + +DROP PROCEDURE IF EXISTS job_schema_update; + +DELIMITER + +CREATE PROCEDURE job_schema_update() +BEGIN + + DECLARE db VARCHAR(100); + SET AUTOCOMMIT = 0; + SELECT DATABASE() INTO db; + + IF NOT EXISTS(SELECT 1 + FROM information_schema.statistics + WHERE TABLE_SCHEMA = db + AND TABLE_NAME = 'file_source_task_log' + AND INDEX_NAME = 'idx_file_source_batch_task_id') THEN + ALTER TABLE file_source_task_log ADD INDEX `idx_file_source_batch_task_id` (file_source_batch_task_id); + END IF; + + COMMIT; +END +DELIMITER ; +COMMIT; + +CALL job_schema_update(); + +DROP PROCEDURE IF EXISTS job_schema_update;