summaryrefslogtreecommitdiffstats
path: root/lib/sql
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-05-07 13:06:35 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-05-08 11:05:33 +0800
commit81a65cc81d151cbb412d2a833abab24dfc133a49 (patch)
tree4cd83752480c2cd3507ee824d7bc927562b10629 /lib/sql
parentb6f1c6d1e2fe24808501b9e9b2f8ac948782c814 (diff)
downloadpatchwork-81a65cc81d151cbb412d2a833abab24dfc133a49.tar.bz2
patchwork-81a65cc81d151cbb412d2a833abab24dfc133a49.tar.xz
migration: Add cleanup-people migration script
Now that we only create Person object once the User has been confirmed, we can clean up unused Person objects from the database. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib/sql')
-rw-r--r--lib/sql/migration/014-cleanup-people.sql7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sql/migration/014-cleanup-people.sql b/lib/sql/migration/014-cleanup-people.sql
new file mode 100644
index 0000000..7c10278
--- /dev/null
+++ b/lib/sql/migration/014-cleanup-people.sql
@@ -0,0 +1,7 @@
+BEGIN;
+DELETE FROM patchwork_person WHERE id NOT IN (
+ SELECT submitter_id FROM patchwork_patch
+ UNION
+ SELECT submitter_id FROM patchwork_comment)
+ AND user_id IS NULL;
+COMMIT;