aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/db/migration/V1.27__followers_unique.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources/db/migration/V1.27__followers_unique.sql')
-rw-r--r--src/main/resources/db/migration/V1.27__followers_unique.sql4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/resources/db/migration/V1.27__followers_unique.sql b/src/main/resources/db/migration/V1.27__followers_unique.sql
new file mode 100644
index 00000000..5a15d9ae
--- /dev/null
+++ b/src/main/resources/db/migration/V1.27__followers_unique.sql
@@ -0,0 +1,4 @@
+DELETE
+FROM followers A USING followers B
+WHERE A.user_id=B.user_id AND A.ts<=B.ts AND A.acct=B.acct AND A.ctid<B.ctid;
+ALTER TABLE followers ADD UNIQUE (user_id, acct) \ No newline at end of file