Announcement

Collapse
No announcement yet.

Many to many unique key referential problem

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

  • Many to many unique key referential problem

    I have a table with performs the many to many link between two other tables.
    I can add and remove a link record by setting the required id fields and saving (and removing)
    Once the intersection record is marked as deleted, I want to re-add the intersection record, but I'm getting a referential integrity error as there is a unique key which uses the 2 id fields but not the deleted field.
    What is the best way to relink a previously unlinked many to many relationship?
    Thanks

  • #2
    When you "remove" an entity in Espo, the table record is not immediately deleted, the "deleted" field in the table is set to "1" (true) and the cleanup job periodically deletes the record.

    Click image for larger version

Name:	Screenshot 2023-01-07 104916.png
Views:	190
Size:	26.1 KB
ID:	86850

    To re-link a previously unlinked record from a a many-to-many relationship, I would use plain vanilla SQL to set the "deleted" field to 0 (false).

    Comment

    Working...
    X