From 835b4055563f8a0b34d4bd5af3a405af370381a3 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Thu, 16 Feb 2017 07:33:48 -0800 Subject: Changed some default values in db. Run install.php is needed. --- modules-available/locationinfo/install.inc.php | 40 +++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) (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 bcd6b1ec..4494ffdd 100644 --- a/modules-available/locationinfo/install.inc.php +++ b/modules-available/locationinfo/install.inc.php @@ -7,10 +7,10 @@ $res[] = tableCreate('location_info', ' `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, - `calendar` VARCHAR(2000) NOT NULL, - `lastcalendarupdate` INT(11) NOT NULL, + `openingtime` VARCHAR(2000), + `config` VARCHAR(2000), + `calendar` VARCHAR(2000), + `lastcalendarupdate` INT(11) NOT NULL DEFAULT 0, PRIMARY KEY (`locationid`) '); @@ -26,6 +26,38 @@ $res[] = tableCreate('setting_location_info', ' // Create response for browser +if (tableHasColumn('location_info', 'openingtime')) { + $ret = Database::exec("ALTER TABLE `location_info` MODIFY openingtime VARCHAR(2000)"); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Updateing column openingtime failed: ' . Database::lastError()); + } + $res[] = UPDATE_DONE; +} + +if (tableHasColumn('location_info', 'config')) { + $ret = Database::exec("ALTER TABLE `location_info` MODIFY config VARCHAR(2000)"); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Updateing column config failed: ' . Database::lastError()); + } + $res[] = UPDATE_DONE; +} + +if (tableHasColumn('location_info', 'calendar')) { + $ret = Database::exec("ALTER TABLE `location_info` MODIFY calendar VARCHAR(2000)"); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Updateing column calendar failed: ' . Database::lastError()); + } + $res[] = UPDATE_DONE; +} + +if (tableHasColumn('location_info', 'lastcalendarupdate')) { + $ret = Database::exec("ALTER TABLE `location_info` MODIFY lastcalendarupdate INT(11) NOT NULL DEFAULT 0"); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Updateing column lastcalendarupdate failed: ' . Database::lastError()); + } + $res[] = UPDATE_DONE; +} + if(tableExists('locationinfo')) { $ret = Database::exec("DROP TABLE `locationinfo`"); if ($ret === false) { -- cgit v1.2.3-55-g7522