Project

General

Profile

Actions

Bug #446

closed

Orphaned dates in database

Added by Alexander Watzinger almost 9 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Category:
Backend
Target version:
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 #1

Updated by Alexander Watzinger almost 9 years ago

  • Project changed from 19 to OpenAtlas
  • Target version deleted (37)
  • Category deleted (37)
Actions #2

Updated by Alexander Watzinger almost 9 years ago

  • Category set to Backend
  • Target version set to 0.9.0
Actions #3

Updated by Alexander Watzinger almost 9 years ago

  • Target version changed from 0.9.0 to 0.10.0
Actions #4

Updated by Alexander Watzinger over 8 years ago

  • Target version changed from 0.10.0 to 1.0.0
Actions #5

Updated by Alexander Watzinger over 8 years ago

  • Target version changed from 1.0.0 to 1.1.0

moved again (to version > 1) because no test data available

Actions #6

Updated by Alexander Watzinger over 8 years ago

  • Target version changed from 1.1.0 to 2.0.0
Actions #7

Updated by Alexander Watzinger over 8 years ago

  • Target version changed from 2.0.0 to 1.2.0
Actions #8

Updated by Alexander Watzinger over 8 years ago

  • Description updated (diff)
  • Status changed from Assigned to In Progress
Actions #9

Updated by Alexander Watzinger over 8 years ago

  • Target version changed from 1.2.0 to 76
Actions #10

Updated by Alexander Watzinger about 8 years ago

  • Target version changed from 76 to 86
Actions #11

Updated by Alexander Watzinger about 8 years ago

  • Found in version set to 1.3.0
Actions #12

Updated by Alexander Watzinger over 7 years ago

  • Target version changed from 86 to 2.4.0
Actions #13

Updated by Alexander Watzinger about 7 years ago

  • Target version changed from 2.4.0 to 2.3.2
Actions #14

Updated by Alexander Watzinger about 7 years ago

  • Status changed from In Progress to Closed

After checking again in 2017 I only found orphaned dates from property_links. The upgrade instruction for 2.3.2. includes SQL statements for removing them and adding a trigger to prevent furhter ones. Closed.

Actions

Also available in: Atom PDF