FAQ | This is a LIVE service | Changelog

Skip to content

GDPR: allow more types of pruning

Dr Catherine Pitt requested to merge gdpr into master

We want to be able to prune data from old incomplete registrations. These can't be found by looking up foreign key references to person(id). This adds a collection of additional pruning queries to be run at the end of the per-person pruning which can have arbitrary SQL queries defined to determine what to delete.

In order not to duplicate the code for producing reverse files and counting the deleted rows the function that deletes rows with person(id) foreign keys has been reworked so that it can be used to do the work for both cases; it now gets passed an SQL query to find the rows to remove and some information about the schema/table it needs to remove from and the column it should search for. It uses those to construct the reversing and deleting queries. This then gets called with the appropriate parameters by both the per-person 'delete whole rows' part of the code, and at the end for the 'additional pruning' code.

Closes #3 (closed)

Merge request reports