Announcement

Collapse
No announcement yet.

unique index entity_email_address causes problems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • unique index entity_email_address causes problems

    Hallo,
    I try to add new fields to the entity 'account' in the admin / entity manager and get error 500: Error while rebuilding database.
    'Doctrine\DBAL\DBALException' with message 'An exception occurred while executing 'CREATE UNIQUE INDEX UNIQ_9125AB4281257D5D59045DAAC412EE02 ON `entity_email_address` (entity_id, email_address_id, entity_type)':
    The problem is that there are duplicate entries, which are deleted. Because we need to know the deleted entries, my idea was to extend the unique index by the fields 'deleted' and 'deteted_id'. So I can leave the entries in the DB. My problem is I can't find the code where I had to put the fields, in the SchemaDiff.php the index is already set.
    Does anyone have an idea where to put these additional fields and if there are any side effects when these fields are added?

  • #2
    Hi

    It's possible to remove duplicates by some sql query. Try to google it.

    Additional fields are declared in entityDefs

    Comment


    • #3
      Deleting the as 'deleted' marked entries is my last option, because we need them for internal reports.
      I want to expand the built-in primary index for the entity_email_address which is used when doing rebuild database, with the field deleted_id. (Also the same for the other indexes for entity...-relations)
      In the entityDefs I think I can only declare additional fields, but I need to find the location to expand the built-in unique index for entity_email_address.

      Comment


      • #4
        I don't know how to achieve it. Try to dig application/Espo/Core/Utils/Database/

        Comment

        Working...
        X