From a27cf8920bf885f644334511bb41dd4be5d0677a Mon Sep 17 00:00:00 2001 From: Dull Bananas Date: Wed, 27 Dec 2023 22:43:28 +0000 Subject: [PATCH] fmt --- .pg_format | 3 -- .../up.sql | 8 +++--- replaceable_schema.sql | 28 ++++++++----------- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/.pg_format b/.pg_format index 55faad57b..6dd061466 100644 --- a/.pg_format +++ b/.pg_format @@ -1,5 +1,2 @@ # Keep normal formatting between `BEGIN` and `COMMIT` statements nogrouping=1 - -# Don't add whitespace around % (used for `format`) in dollar-quoted function body -placeholder=[a-zA-Z0-9_\\.]*%[a-zA-Z0-9_\\.]* diff --git a/migrations/2023-12-25-034523_replaceable-schema/up.sql b/migrations/2023-12-25-034523_replaceable-schema/up.sql index ea00732e4..44bf0b756 100644 --- a/migrations/2023-12-25-034523_replaceable-schema/up.sql +++ b/migrations/2023-12-25-034523_replaceable-schema/up.sql @@ -32,10 +32,10 @@ FROM ( post WHERE post.id = comment.post_id - AND (post.deleted OR post.removed) - )) - GROUP BY - community.id) AS counted + AND (post.deleted + OR post.removed))) + GROUP BY + community.id) AS counted WHERE community_aggregates.community_id = counted.community_id; diff --git a/replaceable_schema.sql b/replaceable_schema.sql index 2c206b4ae..7b3a2f4f1 100644 --- a/replaceable_schema.sql +++ b/replaceable_schema.sql @@ -86,19 +86,15 @@ BEGIN UPDATE thing_report SET - resolved = TRUE, resolver_id = first_removal.mod_person_id, updated = first_removal.when_ - FROM ( SELECT - thing_id, - min(when_) AS when_ - FROM new_removal - WHERE - new_removal.removed - GROUP BY - thing_id) AS first_removal - WHERE - report.thing_id = first_removal.thing_id - AND NOT report.resolved - AND COALESCE(report.updated < first_removal.when_, TRUE); + resolved = TRUE, resolver_id = first_removal.mod_person_id, updated = first_removal.when_ FROM ( + SELECT + thing_id, min(when_) AS when_ FROM new_removal + WHERE + new_removal.removed GROUP BY thing_id) AS first_removal + WHERE + report.thing_id = first_removal.thing_id + AND NOT report.resolved + AND COALESCE(report.updated < first_removal.when_, TRUE); RETURN NULL; END $$; CREATE TRIGGER resolve_reports @@ -444,15 +440,15 @@ BEGIN FROM combine_transition_tables () WHERE ( - SELECT + SELECT local FROM community WHERE community.id = community_id LIMIT 1) - GROUP BY - community_id) AS diff + GROUP BY + community_id) AS diff WHERE a.community_id = diff.community_id; RETURN NULL;