diff options
author | Christian Hofmaier | 2020-09-08 20:56:19 +0200 |
---|---|---|
committer | Christian Hofmaier | 2020-09-08 20:56:19 +0200 |
commit | c535ce5e2f78f5223662c97543f718334abf2a35 (patch) | |
tree | 728fe2fcfe16e33757daeb086ba905c2f834118e /modules-available/locations/install.inc.php | |
parent | [locationinfo] Fix overriding "show hostnames" not being saved (diff) | |
download | slx-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.php | 22 |
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); |