Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
SQL error in migration #831
I was migrating an old version of Omeka from 1.3.1 to 2.5.1 and ran across an error in this line:
which threw this error when upgrading:
What version of MySQL are you using? I presume it's fairly recent, because they seem to have removed ALTER IGNORE.
Now the mystery of why I put the IGNORE in there in the first place... I suppose it was to easily handle the possibility of existing duplicates since that seems to be about all it was good for.
The IGNORE was definitely used for its duplicate ignoring facilities... so simply removing it will avoid this problem for users with sufficiently new MySQL, but anyone who actually has duplicates (i.e., tags that vary only by the entity/user they apply for, a concept we've removed from Omeka) will encounter a different error.
MySQL's generic guidance around the subject, such as it is, is to deduplicate by inserting (with the IGNORE flag, which persists for INSERT) into a new table, dropping the old, and then renaming the new one... which seems like an awful lot of trouble for a six year old migration. At the same time, I'd rather not cut off the ability to migrate large distances in terms of version at once.
I suppose we could use GROUP BY on the new set of unique columns, select one tagging ID from each group and delete every tagging not in that set... which wouldn't be too painful.