Permalink
Browse files

Add sql script for removing old personal data

  • Loading branch information...
andreas-gruenbacher committed Jul 21, 2018
1 parent c899c95 commit 3141267768197b1e763c894332087dc054972275
Showing with 29 additions and 0 deletions.
  1. +29 −0 remove-old-data.sql
@@ -0,0 +1,29 @@
/*
* Remove all personal rider data not used on the results pages from all events
* which are only in series which are no longer "open".
*/

UPDATE riders
SET
street = NULL,
city = NULL,
zip = NULL,
date_of_birth = NULL,
phone = NULL,
emergency_phone = NULL,
license = NULL,
email = NULL,
comment = NULL,
rider_comment = NULL,
insurance = NULL,
version = version + 1
WHERE id NOT IN (
SELECT DISTINCT id
FROM series_events JOIN series USING (serie)
WHERE NOT COALESCE(closed, 0)
UNION
SELECT id
FROM events WHERE id NOT IN (
SELECT id FROM series_events
)
)

0 comments on commit 3141267

Please sign in to comment.