diff options
author | Simon Rettberg | 2017-12-01 13:42:04 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-12-01 13:42:04 +0100 |
commit | 5393703f6e1485ddff94a50f63bcdd216ab629f4 (patch) | |
tree | ce2db7130302bd4fb78b170e1fbd75496a1b4510 /modules-available/runmode/install.inc.php | |
parent | Merge remote-tracking branch 'origin/permission-manager' into permission-manager (diff) | |
parent | [roomplanner] Sort already placed machines to the bottom (diff) | |
download | slx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.tar.gz slx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.tar.xz slx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.zip |
Merge branch 'master' into permission-manager
Diffstat (limited to 'modules-available/runmode/install.inc.php')
-rw-r--r-- | modules-available/runmode/install.inc.php | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/modules-available/runmode/install.inc.php b/modules-available/runmode/install.inc.php index ec710bfa..db7e07f6 100644 --- a/modules-available/runmode/install.inc.php +++ b/modules-available/runmode/install.inc.php @@ -12,21 +12,8 @@ $res[] = tableCreate('runmode', " KEY `module` (`module`,`modeid`) "); -if (!tableExists('machine')) { - // Cannot add constraint yet - $res[] = UPDATE_RETRY; -} else { - $c = tableGetContraints('runmode', 'machineuuid', 'machine', 'machineuuid'); - if ($c === false) - finalResponse(UPDATE_FAILED, 'Cannot get constraints of runmode table: ' . Database::lastError()); - if (empty($c)) { - $alter = Database::exec('ALTER TABLE runmode ADD FOREIGN KEY (machineuuid) REFERENCES machine (machineuuid) - ON DELETE CASCADE ON UPDATE CASCADE'); - if ($alter === false) - finalResponse(UPDATE_FAILED, 'Cannot add machineuuid constraint to runmode table: ' . Database::lastError()); - $res[] = UPDATE_DONE; - } -} +$res[] = tableAddConstraint('runmode', 'machineuuid', 'machine', 'machineuuid', + 'ON DELETE CASCADE ON UPDATE CASCADE'); if (!tableHasColumn('runmode', 'isclient')) { $ret = Database::exec("ALTER TABLE runmode ADD COLUMN isclient bool DEFAULT '1'"); @@ -38,9 +25,4 @@ if (!tableHasColumn('runmode', 'isclient')) { } // Create response for browser - -if (in_array(UPDATE_DONE, $res)) { - finalResponse(UPDATE_DONE, 'Tables created successfully'); -} - -finalResponse(UPDATE_NOOP, 'Everything already up to date');
\ No newline at end of file +responseFromArray($res); |