blob: f1c2b438d8bc140693144ae034c3bd92c7e1bab6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
BEGIN;
DELETE FROM registration_registrationprofile;
-- unlink users who have contributed
UPDATE patchwork_person SET user_id = NULL
WHERE user_id IN (SELECT id FROM auth_user WHERE is_active = False)
AND id IN (SELECT DISTINCT submitter_id FROM patchwork_comment);
-- remove persons who only have a user linkage
DELETE FROM patchwork_person WHERE user_id IN
(SELECT id FROM auth_user WHERE is_active = False);
-- delete profiles
DELETE FROM patchwork_userprofile WHERE user_id IN
(SELECT id FROM auth_user WHERE is_active = False);
-- delete inactive users
DELETE FROM auth_user WHERE is_active = False;
DROP TABLE registration_registrationprofile;
COMMIT;
|