summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/install.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2019-04-03 18:10:28 +0200
committerSimon Rettberg2019-04-03 18:10:28 +0200
commit4d51d90809da34022991e4a8c17caeb28c31bde0 (patch)
treee790d751fbb5883023aaf130f157f4fc23c09c1b /modules-available/locations/install.inc.php
parent[serversetup-bwlp-ipxe] Fix resetting of default bootentries on install (diff)
downloadslx-admin-4d51d90809da34022991e4a8c17caeb28c31bde0.tar.gz
slx-admin-4d51d90809da34022991e4a8c17caeb28c31bde0.tar.xz
slx-admin-4d51d90809da34022991e4a8c17caeb28c31bde0.zip
[statistics/locations] Add locationid constraints; update on delete
We didn't update subnetlocationid when deleting a location, leading to machines pointing to invalid locations.
Diffstat (limited to 'modules-available/locations/install.inc.php')
-rw-r--r--modules-available/locations/install.inc.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules-available/locations/install.inc.php b/modules-available/locations/install.inc.php
index f833568d..d4e1b67b 100644
--- a/modules-available/locations/install.inc.php
+++ b/modules-available/locations/install.inc.php
@@ -30,10 +30,10 @@ $res[] = tableCreate('subnet', '
KEY `locationid` (`locationid`)
');
-// Create response for browser
-
-if (in_array(UPDATE_DONE, $res)) {
- finalResponse(UPDATE_DONE, 'Tables created successfully');
-}
+$res[] = tableAddConstraint('subnet', 'locationid', 'location', 'locationid',
+ 'ON UPDATE CASCADE ON DELETE CASCADE');
+$res[] = tableAddConstraint('setting_location', 'locationid', 'location', 'locationid',
+ 'ON UPDATE CASCADE ON DELETE CASCADE');
-finalResponse(UPDATE_NOOP, 'Everything already up to date');
+// Create response for browser
+responseFromArray($res);