From fb60fb0cd595a20fa3d09a854abeffb33b8b45dc Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 3 Nov 2017 17:56:06 +0100 Subject: [syslog] Tweak machineuuid index in installer --- modules-available/syslog/install.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'modules-available') diff --git a/modules-available/syslog/install.inc.php b/modules-available/syslog/install.inc.php index 539f2449..406a6cc6 100644 --- a/modules-available/syslog/install.inc.php +++ b/modules-available/syslog/install.inc.php @@ -2,7 +2,7 @@ $res = array(); -$res[] = tableCreate('clientlog', " +$res[] = $tc = tableCreate('clientlog', " `logid` int(10) unsigned NOT NULL AUTO_INCREMENT, `dateline` int(10) unsigned NOT NULL, `logtypeid` varchar(30) NOT NULL, @@ -14,7 +14,7 @@ $res[] = tableCreate('clientlog', " KEY `dateline` (`dateline`), KEY `logtypeid` (`logtypeid`,`dateline`), KEY `clientip` (`clientip`,`dateline`), - KEY `machineuuid` (`machineuuid`,`dateline`) + KEY `machineuuid` (`machineuuid`,`logid`) "); // Update path @@ -29,6 +29,12 @@ if (!tableHasColumn('clientlog', 'machineuuid')) { $res[] = UPDATE_DONE; } +// 2017-11-03: Create proper index for query in statistics module +if ($tc !== UPDATE_DONE) { + Database::exec("ALTER TABLE `openslx`.`clientlog` DROP INDEX `machineuuid` , + ADD INDEX `machineuuid` ( `machineuuid` , `logid` )"); +} + // Create response for browser if (in_array(UPDATE_DONE, $res)) { -- cgit v1.2.3-55-g7522