SELECT n1.uid, n1.uid_foreign FROM sys_file_reference n1, sys_file_reference n2 WHERE n1.uid > n2.uid AND n1.uid <> n2.uid AND n1.uid_local = n2.uid_local AND n1.uid_foreign = n2.uid_foreign AND n1.tablenames = n2.tablenames;
And then:
UPDATE sys_file_reference n1, sys_file_reference n2 SET n1.deleted = 1 WHERE n1.uid > n2.uid AND n1.uid <> n2.uid AND n1.uid_local = n2.uid_local AND n1.uid_foreign = n2.uid_foreign AND n1.tablenames = n2.tablenames;
Or if you're brave and have backups:
DELETE n1 FROM sys_file_reference n1, sys_file_reference n2 WHERE n1.uid > n2.uid AND n1.uid <> n2.uid AND n1.uid_local = n2.uid_local AND n1.uid_foreign = n2.uid_foreign AND n1.tablenames = n2.tablenames;
My database exploded when trying the above.
So I did:
And then:
Or if you're brave and have backups: