summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/install.inc.php
diff options
context:
space:
mode:
authorChristian Hofmaier2020-09-08 20:56:19 +0200
committerChristian Hofmaier2020-09-08 20:56:19 +0200
commitc535ce5e2f78f5223662c97543f718334abf2a35 (patch)
tree728fe2fcfe16e33757daeb086ba905c2f834118e /modules-available/locations/install.inc.php
parent[locationinfo] Fix overriding "show hostnames" not being saved (diff)
downloadslx-admin-c535ce5e2f78f5223662c97543f718334abf2a35.tar.gz
slx-admin-c535ce5e2f78f5223662c97543f718334abf2a35.tar.xz
slx-admin-c535ce5e2f78f5223662c97543f718334abf2a35.zip
[locations] Migrate openingtimes from infoscreen to locations module
- move openingtimes from infoscreen db to locations db - read-only openingtimes in infoscreen
Diffstat (limited to 'modules-available/locations/install.inc.php')
-rw-r--r--modules-available/locations/install.inc.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules-available/locations/install.inc.php b/modules-available/locations/install.inc.php
index d4e1b67b..31d53560 100644
--- a/modules-available/locations/install.inc.php
+++ b/modules-available/locations/install.inc.php
@@ -35,5 +35,27 @@ $res[] = tableAddConstraint('subnet', 'locationid', 'location', 'locationid',
$res[] = tableAddConstraint('setting_location', 'locationid', 'location', 'locationid',
'ON UPDATE CASCADE ON DELETE CASCADE');
+// Update
+
+// 2020-07-14 Add openingtime column to location table, then migrate data and delete the column from locationinfo
+
+if (!tableHasColumn('location', 'openingtime')) {
+ if (Database::exec("ALTER TABLE location ADD openingtime BLOB") === false) {
+ finalResponse(UPDATE_FAILED, 'Could not create openingtime column');
+ } else {
+ if (Module::get('locationinfo') !== false) {
+ if (Database::exec(
+ "UPDATE location, locationinfo_locationconfig
+ SET location.openingtime = locationinfo_locationconfig.openingtime
+ WHERE location.locationid = locationinfo_locationconfig.locationid") === false) {
+ finalResponse(UPDATE_FAILED, 'Could not migrate openingtime data from table to table');
+ }
+ if (Database::exec("ALTER TABLE locationinfo_locationconfig DROP COLUMN openingtime") === false) {
+ finalResponse(UPDATE_FAILED, 'Could not delete openingtime column');
+ }
+ }
+ }
+}
+
// Create response for browser
responseFromArray($res);