diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2011-09-19 09:42:44 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2011-09-19 09:42:44 +0800 |
commit | 75d8cf966034e673afe0077ba393d8b2eb3e9b93 (patch) | |
tree | 3f6cf6b9f87ad313d23de77b4c33422e7444a1df /lib/sql/migration/009-drop-registrationprofile.sql | |
parent | 539b6596dc1bf1d3118631095625e354026da373 (diff) | |
parent | f1e5f6a2c9d737f12290f5bd5a934b74c362616f (diff) | |
download | patchwork-75d8cf966034e673afe0077ba393d8b2eb3e9b93.tar.bz2 patchwork-75d8cf966034e673afe0077ba393d8b2eb3e9b93.tar.xz |
Merge branch 'notifications'
Diffstat (limited to 'lib/sql/migration/009-drop-registrationprofile.sql')
-rw-r--r-- | lib/sql/migration/009-drop-registrationprofile.sql | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/sql/migration/009-drop-registrationprofile.sql b/lib/sql/migration/009-drop-registrationprofile.sql new file mode 100644 index 0000000..f1c2b43 --- /dev/null +++ b/lib/sql/migration/009-drop-registrationprofile.sql @@ -0,0 +1,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; |