From 0ab02be35b4f83a10c1d586c7e069b9e1dc4c075 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 24 Dec 2022 04:57:28 +0300 Subject: db: cleanup duplicated followers and add constraints --- src/main/resources/db/specific/postgresql/V1.27__followers_unique.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/resources/db/specific/postgresql/V1.27__followers_unique.sql (limited to 'src/main/resources/db/specific/postgresql') diff --git a/src/main/resources/db/specific/postgresql/V1.27__followers_unique.sql b/src/main/resources/db/specific/postgresql/V1.27__followers_unique.sql new file mode 100644 index 00000000..5a15d9ae --- /dev/null +++ b/src/main/resources/db/specific/postgresql/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