upgrade_126: re-order queries
...otherwise we might delete indexes before the related constraint in case they are different refs #13591
This commit is contained in:
parent
2918ef555e
commit
e4525a09df
|
@ -15,23 +15,6 @@ EXECUTE stmt;
|
|||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
SELECT 1
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = SCHEMA()
|
||||
AND table_name = 'icinga_service_set'
|
||||
AND index_name = 'icinga_service_set_host'
|
||||
)),
|
||||
'ALTER TABLE icinga_service_set DROP INDEX icinga_service_set_host',
|
||||
'SELECT 1'
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @stmt;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
|
@ -50,23 +33,6 @@ EXECUTE stmt;
|
|||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
SELECT 1
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = SCHEMA()
|
||||
AND table_name = 'icinga_service_set'
|
||||
AND index_name = 'icinga_service_set_ibfk_1'
|
||||
)),
|
||||
'ALTER TABLE icinga_service_set DROP INDEX icinga_service_set_ibfk_1',
|
||||
'SELECT 1'
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @stmt;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
|
@ -85,24 +51,6 @@ EXECUTE stmt;
|
|||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
SELECT 1
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = SCHEMA()
|
||||
AND table_name = 'icinga_service_set'
|
||||
AND index_name = 'icinga_service_set_ibfk_2'
|
||||
)),
|
||||
'ALTER TABLE icinga_service_set DROP INDEX icinga_service_set_ibfk_2',
|
||||
'SELECT 1'
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @stmt;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
|
@ -121,23 +69,6 @@ EXECUTE stmt;
|
|||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
SELECT 1
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = SCHEMA()
|
||||
AND table_name = 'icinga_service'
|
||||
AND index_name = 'icinga_service_service_set'
|
||||
)),
|
||||
'ALTER TABLE icinga_service DROP INDEX icinga_service_service_set',
|
||||
'SELECT 1'
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @stmt;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
|
@ -156,6 +87,61 @@ EXECUTE stmt;
|
|||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
SELECT 1
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = SCHEMA()
|
||||
AND table_name = 'icinga_service'
|
||||
AND index_name = 'icinga_service_service_set'
|
||||
)),
|
||||
'ALTER TABLE icinga_service DROP INDEX icinga_service_service_set',
|
||||
'SELECT 1'
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @stmt;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
SELECT 1
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = SCHEMA()
|
||||
AND table_name = 'icinga_service_set'
|
||||
AND index_name = 'icinga_service_set_ibfk_1'
|
||||
)),
|
||||
'ALTER TABLE icinga_service_set DROP INDEX icinga_service_set_ibfk_1',
|
||||
'SELECT 1'
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @stmt;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
SELECT 1
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = SCHEMA()
|
||||
AND table_name = 'icinga_service_set'
|
||||
AND index_name = 'icinga_service_set_host'
|
||||
)),
|
||||
'ALTER TABLE icinga_service_set DROP INDEX icinga_service_set_host',
|
||||
'SELECT 1'
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @stmt;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
SELECT 1
|
||||
|
@ -174,6 +160,24 @@ DEALLOCATE PREPARE stmt;
|
|||
SET @stmt = NULL;
|
||||
|
||||
|
||||
SET @stmt = (SELECT IF(
|
||||
(SELECT EXISTS(
|
||||
SELECT 1
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = SCHEMA()
|
||||
AND table_name = 'icinga_service_set'
|
||||
AND index_name = 'icinga_service_set_ibfk_2'
|
||||
)),
|
||||
'ALTER TABLE icinga_service_set DROP INDEX icinga_service_set_ibfk_2',
|
||||
'SELECT 1'
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @stmt;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
SET @stmt = NULL;
|
||||
|
||||
|
||||
ALTER TABLE icinga_service_set
|
||||
ADD CONSTRAINT icinga_service_set_host
|
||||
FOREIGN KEY host (host_id)
|
||||
|
|
Loading…
Reference in New Issue