Bug #13353

Attempting to delete Term that is used in existing Relationships causes 500 server error and prematurely removes term from Elasticsearch

Added by Tessa Walsh about 1 month ago. Updated about 1 month ago.

Status:NewStart date:06/15/2020
Priority:LowDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Google Code Legacy ID: Tested version:2.5
Sponsored:No Requires documentation:

Description

If a user attempts to delete a Term that is actively associated to authority records in the Relation table, deleting the term from the database fails due to foreign key constraints and a 500 Server Error is thrown. Sample log output:


PHP message: Unable to execute DELETE statement. [wrapped: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (atomDev.relation, CONSTRAINT relation_FK_4 FOREIGN KEY (type_id) REFERENCES term (id))]

In addition, the term is removed from the Elasticsearch despite not being deleted from the database, which makes it no longer appear in search results on the appropriate taxonomy page (Browse Actor Relation, in my case) despite the deletion not being successful.


Related issues

Related to Access to Memory (AtoM) - Task #10306: Improve foreign key declarations in database schema Verified 09/14/2016
Related to Access to Memory (AtoM) - Feature #13302: Filter Authority record searches by relationship type Verified 05/20/2020

History

#1 Updated by José Raddaoui Marín about 1 month ago

  • Related to Task #10306: Improve foreign key declarations in database schema added

#2 Updated by José Raddaoui Marín about 1 month ago

Thanks Tessa, great detective work!

Part of the problem has been addressed in #10306 for the 2.6 release, although more work may needed to keep the related resources updated in Elasticsearch.

#3 Updated by José Raddaoui Marín about 1 month ago

  • Related to Feature #13302: Filter Authority record searches by relationship type added

Also available in: Atom PDF