View | Details | Raw Unified | Return to bug 36569
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_36569-compact-action_logs-indices.pl (+19 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "36569",
5
    description => "Compact action_logs columns module and actions",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        say $out "Modify columns module and action, this can take a long time if the table action_logs is large.";
11
        say $out "Make sure that there is disk space for an extra copy of action_logs while upgrading!";
12
        $dbh->do(
13
            q{ALTER TABLE action_logs MODIFY COLUMN module VARCHAR(30) CHARSET ascii, MODIFY COLUMN action VARCHAR(30) CHARSET ascii}
14
        );
15
16
        say $out "Create combined index action_logs(module, action)";
17
        $dbh->do(q{CREATE INDEX IF NOT EXISTS module_action_idx ON action_logs(module, action)});
18
    },
19
};
(-)a/installer/data/mysql/kohastructure.sql (-5 / +5 lines)
Lines 166-173 CREATE TABLE `action_logs` ( Link Here
166
  `action_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each action',
166
  `action_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each action',
167
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the action took place',
167
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the action took place',
168
  `user` int(11) NOT NULL DEFAULT 0 COMMENT 'the staff member who performed the action (borrowers.borrowernumber)',
168
  `user` int(11) NOT NULL DEFAULT 0 COMMENT 'the staff member who performed the action (borrowers.borrowernumber)',
169
  `module` mediumtext DEFAULT NULL COMMENT 'the module this action was taken against',
169
  `module` varchar(30) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL COMMENT 'the module this action was taken against',
170
  `action` mediumtext DEFAULT NULL COMMENT 'the action (includes things like DELETED, ADDED, MODIFY, etc)',
170
  `action` varchar(30) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL COMMENT 'the action (includes things like DELETED, ADDED, MODIFY, etc)',
171
  `object` int(11) DEFAULT NULL COMMENT 'the object that the action was taken against (could be a borrowernumber, itemnumber, etc)',
171
  `object` int(11) DEFAULT NULL COMMENT 'the object that the action was taken against (could be a borrowernumber, itemnumber, etc)',
172
  `info` mediumtext DEFAULT NULL COMMENT 'information about the action (usually includes SQL statement)',
172
  `info` mediumtext DEFAULT NULL COMMENT 'information about the action (usually includes SQL statement)',
173
  `interface` varchar(30) DEFAULT NULL COMMENT 'the context this action was taken in',
173
  `interface` varchar(30) DEFAULT NULL COMMENT 'the context this action was taken in',
Lines 176-183 CREATE TABLE `action_logs` ( Link Here
176
  PRIMARY KEY (`action_id`),
176
  PRIMARY KEY (`action_id`),
177
  KEY `timestamp_idx` (`timestamp`),
177
  KEY `timestamp_idx` (`timestamp`),
178
  KEY `user_idx` (`user`),
178
  KEY `user_idx` (`user`),
179
  KEY `module_idx` (`module`(191)),
179
  KEY `module_idx` (`module`),
180
  KEY `action_idx` (`action`(191)),
180
  KEY `action_idx` (`action`),
181
  KEY `module_action_idx` (`module`, `action`),
181
  KEY `object_idx` (`object`),
182
  KEY `object_idx` (`object`),
182
  KEY `info_idx` (`info`(191)),
183
  KEY `info_idx` (`info`(191)),
183
  KEY `interface` (`interface`)
184
  KEY `interface` (`interface`)
184
- 

Return to bug 36569