hubzero/hubzero-cms

`ALTER IGNORE TABLE` in ComTags migration is a syntax error in MySQL > 5.7.4

Closed this issue · 0 comments

Running migrations against our HZ backed by MySQL 5.7.24 produces an error:

Error: running up() resulted in

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IGNORE TABLE `jos_tags_object` ADD UNIQUE INDEX unique_tag_per_obj (objectid, ta' at line 1

in core/migrations/Migration20190902000001ComTags.php

It's because this line creates a query with the syntax "ALTER IGNORE TABLE":

$query = "ALTER IGNORE TABLE `#__tags_object` ADD UNIQUE INDEX unique_tag_per_obj (objectid, tagid, tbl)";

...but that syntax is no longer valid in MySQL versions after 5.7.4.

https://stackoverflow.com/questions/34972695/mysql-alter-ignore-table-error-in-syntax/34972759

Removing "IGNORE" from the statement allows it to proceed without error.