Actions
Bug #446
closedOrphaned dates in database
Start date:
2015-06-08
Estimated time:
4.00 h
Found in version:
Description
If e.g. a Person with relations is deleted, the relations are deleted but the relation dates remain.
I'm trying to avoid to "manualy" delete them because there will be many cases like that and it's just too error prone.
Another aproach would be to write a cleanup function which searches for orphaned entries and call it with every delete.
Update
Deleting dates (from entities), alternative names, and location/gis data already implemented.
Did a check on existing data and dates of property links seem to be the only orphaned ones.
No link dates, aliases or gis entries were orphaned.
SQL to check for orphaned data (doesn't detect dates of property links because they still have a type)
SELECT e.id FROM crm.entity e LEFT JOIN crm.link l1 on e.id = l1.domain_id LEFT JOIN crm.link l2 on e.id = l2.range_id LEFT JOIN crm.link_property lp1 on e.id = lp1.domain_id LEFT JOIN crm.link_property lp2 on e.id = lp2.range_id WHERE l1.domain_id IS NULL AND l2.range_id IS NULL AND lp1.domain_id IS NULL AND lp2.range_id IS NULL
Actions