Database cleanup of orphaned records
See original GitHub issueFollow up from https://github.com/cgeo/cgeo/issues/6186#issuecomment-270253650.
It turned out that due to the lack of foreign keys in the DB it happens that geocaches got deleted from cg_caches
without their related records in dependent tables like cg_logs
, cg_waypoints
, …
The DataStore.cleanIfNeeded()
is the housekeeping method which regulary (on startup) cleans up the database. This should be extended to also clean up these orphaned records as well.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
How do you clean up a table that has orphaned records (SQL ...
Perform explain query, try to get where it is consuming time. · Try to add more filters as much as you can. ·...
Read more >How to detect and handle orphaned data in your databases ...
E- Step 5 - Finding & Deleting The Orphaned Data. IV. ... Once you know that, you can locate the data easily, and...
Read more >Cleanup orphaned records - mysql - DBA Stack Exchange
Cleanup orphaned records ... I have two tables in MySQL: orders and line items. When orders are deleted, the line items are orphaned....
Read more >Clean up table that has orphaned records - Stack Overflow
Since in Base Table record with id 5 and 6 is not referring from any table, this two are orphaned records, i want...
Read more >Database Cleanup: Orphaned Discovered Software Records ...
This document describes how to identify and cleanup orphaned discovered software records in the Client Automation (ITCM) mdb database.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@SammysHP
ON DELETE CASCADE
can be used when we have introduced foreign keys. That would be the best solution. But we would need the cleanup then anyway. Before that we can’t introduce the foreign keys.I couldn’t find a DB Schema, so I drew one. I’ll also add this to the wiki:
Thanks to the database file from @SammysHP I found another possible inconsistency. There were some caches associated with a list which doesn’t exist. They didn’t show up anywhere but blocked the housekeeping process. I’ve updated the PR.