]> git.ozlabs.org Git - patchwork/blobdiff - lib/sql/migration/014-cleanup-people.sql
migration: Add cleanup-people migration script
[patchwork] / 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 (file)
index 0000000..7c10278
--- /dev/null
@@ -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;