Skip to content

Commit

Permalink
cats: Fix upgrading MySQL database from version 2171 to 2192
Browse files Browse the repository at this point in the history
"CREATE INDEX IF NOT EXISTS ..." does not work on MySQL.

Instead "ALTER TABLE Job ADD INDEX (JobTDate);" is compatible to
MariaDB and MySQL. This also works if an index is already in place.

Unfortunately we could end up having multiple indexes on
JobTDate this way, so manually cleaning up could be required.

Perform also a key distribution analysis on the PathVisibility
table after index drop.

Fixes #1176: Upgrade 18.2.5 to 19.2.5 failed ...
  • Loading branch information
fbergkemper committed Feb 10, 2020
1 parent b911f9b commit fcf7370
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/cats/ddl/updates/mysql.2171_2192.sql
Expand Up @@ -3,7 +3,7 @@
BEGIN;

-- adapt index
CREATE INDEX IF NOT EXISTS jobtdate_idx ON Job (JobTDate);
ALTER TABLE Job ADD INDEX (JobTDate);

-- change BaseFiles.BaseId data type
ALTER TABLE BaseFiles MODIFY BaseId BIGINT;
Expand All @@ -16,3 +16,4 @@ UPDATE Version SET VersionId = 2192;
COMMIT;

ANALYZE TABLE Job;
ANALYZE TABLE PathVisibility;

0 comments on commit fcf7370

Please sign in to comment.