add ServerId to Storage

This commit is contained in:
Isaac Connor 2017-12-22 11:38:59 -08:00
parent 0d7fff761c
commit 0c350b8f41
2 changed files with 13 additions and 0 deletions

View File

@ -640,6 +640,7 @@ CREATE TABLE `Storage` (
`Type` enum('local','s3fs') NOT NULL default 'local',
`DiskSpace` bigint unsigned default NULL,
`Scheme enum('Deep','Medium','Shallow') NOT NULL default 'Medium',
`ServerId` int(10) unsigned,
PRIMARY KEY (`Id`)
) ENGINE=@ZM_MYSQL_ENGINE@;

12
db/zm_update-1.31.18.sql Normal file
View File

@ -0,0 +1,12 @@
SET @s = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
AND table_name = 'Storage'
AND column_name = 'ServerId'
) > 0,
"SELECT 'Column ServerId already exists in Storage'",
"ALTER TABLE Storage ADD `ServerId` int(10) unsigned AFTER `Scheme`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;