From 81a65cc81d151cbb412d2a833abab24dfc133a49 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 7 May 2014 13:06:35 +0800 Subject: [PATCH] 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 --- lib/sql/migration/014-cleanup-people.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/sql/migration/014-cleanup-people.sql 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; -- 2.39.2