]> git.ozlabs.org Git - patchwork/blob - lib/sql/migration/009-drop-registrationprofile.sql
login: Focus the username field on load
[patchwork] / lib / sql / migration / 009-drop-registrationprofile.sql
1 BEGIN;
2
3 DELETE FROM registration_registrationprofile;
4
5 -- unlink users who have contributed
6
7 UPDATE patchwork_person SET user_id = NULL
8     WHERE user_id IN (SELECT id FROM auth_user WHERE is_active = False)
9             AND id IN (SELECT DISTINCT submitter_id FROM patchwork_comment);
10
11 -- remove persons who only have a user linkage
12
13 DELETE FROM patchwork_person WHERE user_id IN
14     (SELECT id FROM auth_user WHERE is_active = False);
15
16 -- delete profiles
17
18 DELETE FROM patchwork_userprofile WHERE user_id IN
19     (SELECT id FROM auth_user WHERE is_active = False);
20
21 -- delete inactive users
22
23 DELETE FROM auth_user WHERE is_active = False;
24
25 DROP TABLE registration_registrationprofile;
26
27 COMMIT;