MySQL error when updating Any Addons

Permalink
Hello.

We have a site where every time we try and update any of the Addons we get:

An exception occurred while executing 'ALTER TABLE ExpressEntityAssociationSelectedEntries ADD CONSTRAINT FK_1F9C570CBF396750 FOREIGN KEY (id) REFERENCES ExpressEntityEntryAssociations (id)':
SQLSTATE[23000]: Integrity constraint violation: 1022 Can't write; duplicate key in table '#sql-3748ff_1aefcba'


It appears that the Addon has been updated.

I found 'FOREIGN KEY problem on Packages', among others, in the Forums and attempted this:

The command prompt:

concrete/bin/concrete5 orm:schema-tool:update --dump-sql


produced:

ALTER TABLE ExpressEntityAssociationSelectedEntries ADD CONSTRAINT FK_1F9C570CBF396750 FOREIGN KEY (id) REFERENCES ExpressEntityEntryAssociations (id);
ALTER TABLE ExpressEntityAssociationSelectedEntries ADD CONSTRAINT FK_1F9C570CC7B1F65C FOREIGN KEY (exSelectedEntryID) REFERENCES ExpressEntityEntries (exEntryID);
DROP INDEX cPath ON PagePaths;


When I try this on the database:

SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE ExpressEntityAssociationSelectedEntries ADD CONSTRAINT FK_1F9C570CBF396750 FOREIGN KEY (id) REFERENCES ExpressEntityEntryAssociations (id);
ALTER TABLE ExpressEntityAssociationSelectedEntries ADD CONSTRAINT FK_1F9C570CC7B1F65C FOREIGN KEY (exSelectedEntryID) REFERENCES ExpressEntityEntries (exEntryID);
DROP INDEX cPath ON PagePaths;
SET FOREIGN_KEY_CHECKS=1;


I get:
Error
SQL query:Documentation
ALTER TABLE ExpressEntityAssociationSelectedEntries ADD CONSTRAINT FK_1F9C570CBF396750 FOREIGN KEY (id) REFERENCES ExpressEntityEntryAssociations (id)
MySQL said:Documentation
#1022 - Can't write; duplicate key in table '#sql-4214_16'



If I run:
SHOW INDEX FROM ExpressEntityAssociationSelectedEntries;
I can see the entries. (see attached picture)

Bit stuck now. Would anyone have an idea please?

1 Attachment

tangent