From a86d0225dc7768a629ce59c325a1dcc739122ef9 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Mon, 5 Dec 2016 09:56:44 -0800 Subject: Locationinfo: Added Servertable --- modules-available/locationinfo/install.inc.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'modules-available/locationinfo/install.inc.php') diff --git a/modules-available/locationinfo/install.inc.php b/modules-available/locationinfo/install.inc.php index f94c725e..162f000c 100644 --- a/modules-available/locationinfo/install.inc.php +++ b/modules-available/locationinfo/install.inc.php @@ -3,7 +3,9 @@ $res = array(); $res[] = tableCreate('location_info', ' - `locationid` INT(11) NOT NULL, + `locationid` INT(11) NOT NULL, + `serverid` INT(11) NOT NULL, + `serverroomid` INT(11) NOT NULL, `hidden` BOOLEAN NOT NULL DEFAULT 0, `openingtime` VARCHAR(2000) NOT NULL, `config` VARCHAR(2000) NOT NULL, @@ -13,6 +15,7 @@ $res[] = tableCreate('location_info', ' $res[] = tableCreate('setting_location_info', ' `serverid` int(10) NOT NULL AUTO_INCREMENT, + `servername` VARCHAR(2000) NOT NULL, `serverurl` VARCHAR(2000) NOT NULL, `servertype` VARCHAR(100) NOT NULL, `login` VARCHAR(100) NOT NULL, @@ -46,6 +49,22 @@ if (!tableHasColumn('location_info', 'calendar')) { $res[] = UPDATE_DONE; } +if (!tableHasColumn('location_info', 'serverid')) { + $ret = Database::exec("ALTER TABLE `location_info` ADD `serverid` INT(11) NOT NULL AFTER `locationid`"); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Adding serverid to location_info failed: ' . Database::lastError()); + } + $res[] = UPDATE_DONE; +} + +if (!tableHasColumn('location_info', 'serverroomid')) { + $ret = Database::exec("ALTER TABLE `location_info` ADD `serverroomid` INT(11) NOT NULL AFTER `serverid`"); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Adding serverroomid to location_info failed: ' . Database::lastError()); + } + $res[] = UPDATE_DONE; +} + if (in_array(UPDATE_DONE, $res)) { finalResponse(UPDATE_DONE, 'Tables created successfully'); } -- cgit v1.2.3-55-g7522