unique index entity_email_address causes problems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seylero
    Junior Member
    • Jan 2016
    • 4

    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?
  • yuri
    Member
    • Mar 2014
    • 8478

    #2
    Hi

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

    Additional fields are declared in entityDefs
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • seylero
      Junior Member
      • Jan 2016
      • 4

      #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

      • yuri
        Member
        • Mar 2014
        • 8478

        #4
        I don't know how to achieve it. Try to dig application/Espo/Core/Utils/Database/
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        Working...