diff options
-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; |