diff options
author | Simon Rettberg | 2019-01-02 15:01:51 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-01-02 15:01:51 +0100 |
commit | a27ba66b59fbbdccd1679bcda77a8acb2f41a5c5 (patch) | |
tree | 95092ddc57547a8c7788a76639561e4bdb4332a7 /modules-available/serversetup-bwlp/install.inc.php | |
parent | Merge branch 'master' into ipxe (diff) | |
download | slx-admin-a27ba66b59fbbdccd1679bcda77a8acb2f41a5c5.tar.gz slx-admin-a27ba66b59fbbdccd1679bcda77a8acb2f41a5c5.tar.xz slx-admin-a27ba66b59fbbdccd1679bcda77a8acb2f41a5c5.zip |
[serversetup-bwlp] Add column to override default menuentry of location
Diffstat (limited to 'modules-available/serversetup-bwlp/install.inc.php')
-rw-r--r-- | modules-available/serversetup-bwlp/install.inc.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/modules-available/serversetup-bwlp/install.inc.php b/modules-available/serversetup-bwlp/install.inc.php index 8814bb7c..67d6693f 100644 --- a/modules-available/serversetup-bwlp/install.inc.php +++ b/modules-available/serversetup-bwlp/install.inc.php @@ -40,8 +40,10 @@ $res[] = tableCreate('serversetup_menuentry', " $res[] = tableCreate('serversetup_menu_location', ' `menuid` int(11) NOT NULL, `locationid` int(11) NOT NULL, + `defaultentryid` int(11) DEFAULT NULL, PRIMARY KEY (`menuid`,`locationid`), - UNIQUE `locationid` (`locationid`) + UNIQUE `locationid` (`locationid`), + KEY `defaultentryid` (`defaultentryid`) '); $res[] = tableCreate('serversetup_localboot', " @@ -50,6 +52,15 @@ $res[] = tableCreate('serversetup_localboot', " PRIMARY KEY (`systemmodel`) "); +// Add defaultentry override column +if (!tableHasColumn('serversetup_menu_location', 'defaultentryid')) { + if (Database::exec('ALTER TABLE serversetup_menu_location ADD COLUMN `defaultentryid` int(11) DEFAULT NULL')) { + $res[] = UPDATE_DONE; + } else { + $res[] = UPDATE_FAILED; + } +} + $res[] = tableAddConstraint('serversetup_menu', 'defaultentryid', 'serversetup_menuentry', 'menuentryid', 'ON DELETE SET NULL'); @@ -62,6 +73,9 @@ $res[] = tableAddConstraint('serversetup_menuentry', 'menuid', 'serversetup_menu $res[] = tableAddConstraint('serversetup_menu_location', 'menuid', 'serversetup_menu', 'menuid', 'ON UPDATE CASCADE ON DELETE CASCADE'); +$res[] = tableAddConstraint('serversetup_menu_location', 'defaultentryid', 'serversetup_menuentry', 'menuentryid', + 'ON UPDATE CASCADE ON DELETE SET NULL'); + if (Module::get('location') !== false) { if (!tableExists('location')) { $res[] = UPDATE_RETRY; |