From 6e89e15c7844afe054ca9c214e200a44e23e1a78 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 3 Apr 2019 18:10:28 +0200 Subject: [statistics/locations] Add locationid constraints; update on delete We didn't update subnetlocationid when deleting a location, leading to machines pointing to invalid locations. --- modules-available/locations/install.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'modules-available/locations/install.inc.php') 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); -- cgit v1.2.3-55-g7522