Ticket #523 (new defect)
Opened 4 years ago
Database intergrity
Reported by: | ed | Owned by: | jim |
---|---|---|---|
Priority: | minor | Milestone: | Production |
Component: | Views & content types | Keywords: | |
Cc: | ed | Estimated Number of Hours: | 0.0 |
Add Hours to Ticket: | 0 | Billable?: | yes |
Total Hours: | 0 |
Description
Following on from comment 4 of ticket 516 (https://tech.transitionnetwork.org/trac/ticket/516#comment:4) , I wanted to check the integrity of the field tables, so I crafted and ran this query:
SELECT count(cck.nid) FROM content_field_region cck
LEFT JOIN node node on cck.nid = node.nid
WHERE node.nid IS NULL
Which returned 1,173 rows. I then replaced the 'content_field_region' with other fields found on the user profile nodes (which have their own database table) so the full breakdown is:
content_field_region = 1173
content_field_initiative = 1165
content_field_themes = 6256
content_field_training_attended = 1165
content_field_roles_offered = 1285
content_field_other_websites = 1181
content_field_user_types = 1165
So what this means is there are around 1200 entries in field database storage for the above tables that do not have an associated node. This means the data is not properly referentially integral, and ideally these should be cleaned up one day.
The risk is low but it's worth doing a the rest of the audit (with the other fields that have tables of their own) and then cleaning these up at some point. These will have been caused by manual deletes and imports over the years. Drupal would normally keep these sorted but we've had to bypass Drupal a few times.
Or we can leave it as is and let the migration to Drupal 8 resolve this. The cost is a bit more database space and a slightly slower site... Though this *may* cause a bug or two.