add indexes for Monitors(ServerId) and Servers(Name)

This commit is contained in:
Isaac Connor 2016-10-20 13:18:33 -04:00
parent 67e14bd12f
commit 4fc85fd89c
2 changed files with 40 additions and 1 deletions

39
db/zm_update-1.30.9.sql Normal file
View File

@ -0,0 +1,39 @@
--
-- This updates a 1.30.9 database to 1.30.9
--
--
-- Update Monitors table to have an Index on ServerId
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.STATISTICS
WHERE table_name = 'Monitors'
AND table_schema = DATABASE()
AND index_name = 'Monitors_ServerId_idx'
) > 0,
"SELECT 'Monitors_ServerId Index already exists on Monitors table'",
"CREATE INDEX `Monitors_ServerId_idx` ON `Monitors` (`ServerId`)"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
--
-- Update Server table to have an Index on Name
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.STATISTICS
WHERE table_name = 'Servers'
AND table_schema = DATABASE()
AND index_name = 'Servers_Name_idx'
) > 0,
"SELECT 'Servers_Name Index already exists on Servers table'",
"CREATE INDEX `Servers_Name_idx` ON `Servers` (`Name`)"
));
PREPARE stmt FROM @s;
EXECUTE stmt;

View File

@ -1 +1 @@
1.30.8
1.30.9