diff options
author | Simon Rettberg | 2022-07-04 15:42:13 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-07-04 15:42:13 +0200 |
commit | 878dbac85a9f684916e2d30cab4782e21a03e767 (patch) | |
tree | e4e8edc6e61b10c1f6bc15f12a1d9c09677a3103 /modules-available/main/install.inc.php | |
parent | Fix typos (diff) | |
download | slx-admin-878dbac85a9f684916e2d30cab4782e21a03e767.tar.gz slx-admin-878dbac85a9f684916e2d30cab4782e21a03e767.tar.xz slx-admin-878dbac85a9f684916e2d30cab4782e21a03e767.zip |
[rebootcontrol/main] Add subkey column to property_list table
This makes it easier to reference to list entries that have non-trivial
data values, e.g. long json data.
Diffstat (limited to 'modules-available/main/install.inc.php')
-rw-r--r-- | modules-available/main/install.inc.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/modules-available/main/install.inc.php b/modules-available/main/install.inc.php index b7dd2c4d..a19a069d 100644 --- a/modules-available/main/install.inc.php +++ b/modules-available/main/install.inc.php @@ -28,10 +28,13 @@ $res[] = tableCreate('property', " $res[] = tableCreate('property_list', " `name` varchar(50) NOT NULL, + `subkey` int(10) unsigned NOT NULL AUTO_INCREMENT, `dateline` int(10) unsigned NOT NULL DEFAULT '0', `value` text NOT NULL, KEY (`name`), - KEY `dateline` (`dateline`) + KEY `dateline` (`dateline`), + ADD KEY (`subkey`), + UNIQUE KEY `compound` (`name`, `subkey`) "); $res[] = tableCreate('user', " @@ -116,6 +119,19 @@ if (!tableHasColumn('user', 'serverid')) { Database::exec("ALTER TABLE `user` ADD `serverid` int(10) unsigned NULL DEFAULT NULL"); } +// +// +if (!tableHasColumn('property_list', 'subkey')) { + $ret = Database::exec("ALTER TABLE property_list + ADD COLUMN `subkey` int(10) unsigned NOT NULL AUTO_INCREMENT AFTER `name`, + ADD KEY (`subkey`), + ADD UNIQUE KEY `compound` (`name`, `subkey`)"); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Cannot add subkey to property_list: ' . Database::lastError()); + } + $res[] = UPDATE_DONE; +} + // Make sure that if any users exist, one of the has UID=1, otherwise if the permission module is // used we'd lock out everyone $someUser = Database::queryFirst('SELECT userid FROM user ORDER BY userid ASC LIMIT 1'); |