Bug 30984: (QA follow-up) Switch from mediumtext to varchar(255)

My research indeicates that tinytext of less than 40 bytes uses
about the same storage as a varchar(255). Also, using
a TEXT field in a complex query may create a temp table.
varchar fields are also more efficient for sorting on.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5266069016)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Kyle Hall 2022-07-29 06:53:06 -04:00 committed by Lucas Gass
parent 1fe48f965c
commit 6106f6926a
2 changed files with 2 additions and 2 deletions

View file

@ -9,7 +9,7 @@ return {
if( !column_exists( 'action_logs', 'script' ) ) { if( !column_exists( 'action_logs', 'script' ) ) {
$dbh->do(q{ $dbh->do(q{
ALTER TABLE action_logs ALTER TABLE action_logs
ADD COLUMN script mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the name of the cron script that caused this change' ADD COLUMN script varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the name of the cron script that caused this change'
AFTER interface AFTER interface
}); });
} }

View file

@ -175,7 +175,7 @@ CREATE TABLE `action_logs` (
`object` int(11) DEFAULT NULL COMMENT 'the object that the action was taken against (could be a borrowernumber, itemnumber, etc)', `object` int(11) DEFAULT NULL COMMENT 'the object that the action was taken against (could be a borrowernumber, itemnumber, etc)',
`info` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'information about the action (usually includes SQL statement)', `info` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'information about the action (usually includes SQL statement)',
`interface` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the context this action was taken in', `interface` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the context this action was taken in',
`script` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the name of the cron script that caused this change', `script` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the name of the cron script that caused this change',
PRIMARY KEY (`action_id`), PRIMARY KEY (`action_id`),
KEY `timestamp_idx` (`timestamp`), KEY `timestamp_idx` (`timestamp`),
KEY `user_idx` (`user`), KEY `user_idx` (`user`),