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;
--
# and is automatically called by Auth.pm when needed.
sub kohaversion {
- return "3.00.00.016";
+ return "3.00.00.017";
}
1;
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)