diff --git a/installer/kohastructure.sql b/installer/kohastructure.sql index 5bbf29a33f..61bb52b152 100644 --- a/installer/kohastructure.sql +++ b/installer/kohastructure.sql @@ -59,13 +59,15 @@ CREATE TABLE `accountoffsets` ( DROP TABLE IF EXISTS `action_logs`; CREATE TABLE `action_logs` ( + `action_id` int(11) NOT NULL auto_increment, `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `user` int(11) NOT NULL default 0, `module` text, `action` text, `object` int(11) default NULL, `info` text, - PRIMARY KEY (`timestamp`,`user`) + PRIMARY KEY (`action_id`), + KEY (`timestamp`,`user`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- diff --git a/kohaversion.pl b/kohaversion.pl index b4abdda92d..737f24d7c7 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -8,7 +8,7 @@ # and is automatically called by Auth.pm when needed. sub kohaversion { - return "3.00.00.016"; + return "3.00.00.017"; } 1; diff --git a/updater/updatedatabase b/updater/updatedatabase index 7f031151db..599e0c6874 100755 --- a/updater/updatedatabase +++ b/updater/updatedatabase @@ -504,6 +504,16 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.00.00.017"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE action_logs DROP PRIMARY KEY"); + $dbh->do("ALTER TABLE action_logs ADD KEY timestamp (timestamp,user)"); + $dbh->do("ALTER TABLE action_logs ADD action_id INT(11) NOT NULL FIRST"); + $dbh->do("UPDATE action_logs SET action_id = if (@a, @a:=@a+1, @a:=1)"); + $dbh->do("ALTER TABLE action_logs MODIFY action_id AUTO_INCREMENT PRIMARY KEY"); + print "Upgrade to $DBversion done (added column to action_logs)\n"; + SetVersion ($DBversion); +} =item DropAllForeignKeys($table)