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:11:43 +0200
commit6e89e15c7844afe054ca9c214e200a44e23e1a78 (patch)
treec38ad51c578cafa71c52bd6efae346495cccaa49 /modules-available/locations/install.inc.php
parent[locationinfo] Style checkboxes, use icon in save button (diff)
downloadslx-admin-6e89e15c7844afe054ca9c214e200a44e23e1a78.tar.gz
slx-admin-6e89e15c7844afe054ca9c214e200a44e23e1a78.tar.xz
slx-admin-6e89e15c7844afe054ca9c214e200a44e23e1a78.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);