Delete duplicate records from MM tables

If somehow (f.e. because of a migration from DAM to FAL) you face with duplicate records in MM table you need a small trick to be able to delete them.

Screen Shot 2014-11-28 at 16.46.55

The solution is quite simple:

ALTER TABLE sys_category_record_mm ENGINE MyISAM;
ALTER IGNORE TABLE sys_category_record_mm ADD UNIQUE KEY uidx(uid_local, uid_foreign, tablenames);
ALTER TABLE sys_category_record_mm ENGINE InnoDB;

With this MySql command deletes the server all duplicates but only one line.

The change in the database engine is needed because of a bug in specific InnoDB versions. See http://bugs.mysql.com/bug.php?id=40344

Getagged mit: , , ,
Veröffentlicht unter Database, TYPO3 Technik

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*