add Id to Filters

This commit is contained in:
Isaac Connor 2017-07-11 20:35:56 -04:00
parent 046acbc05b
commit 4a90980fbe
1 changed files with 18 additions and 0 deletions

View File

@ -116,3 +116,21 @@ ALTER TABLE Logs MODIFY Message TEXT NOT NULL;
ALTER TABLE Config MODIFY DefaultValue TEXT; ALTER TABLE Config MODIFY DefaultValue TEXT;
--
-- Add an Id column and make it the primary key of the Filters table
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Filters'
AND table_schema = DATABASE()
AND column_name = 'Id'
) > 0,
"SELECT 'Column Id exists in Filters'",
"ALTER TABLE `Filters` DROP PRIMARY KEY, ADD `Id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY FIRST, ADD KEY `Name` (`Name`);"
));
PREPARE stmt FROM @s;
EXECUTE stmt;