From 662113dfc17d25657995cd9354d93ca0161119ca Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 23 Jun 2023 17:25:31 +0300 Subject: [PATCH] fix 500 error on making post --- migrations/20230623-rename-submissions-to-posts.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/migrations/20230623-rename-submissions-to-posts.sql b/migrations/20230623-rename-submissions-to-posts.sql index 9e027b15c..c06278393 100644 --- a/migrations/20230623-rename-submissions-to-posts.sql +++ b/migrations/20230623-rename-submissions-to-posts.sql @@ -14,3 +14,15 @@ alter table subactions rename constraint subactions_submission_fkey to subaction alter table subscriptions rename constraint subscription_submission_fkey to subscription_post_fkey; alter table post_option_votes rename constraint vote_submission_fkey to vote_post_fkey; alter table votes rename constraint vote_submission_key to vote_post_key; + +drop function bump_utc; + +CREATE FUNCTION public.bump_utc(public.posts) RETURNS integer + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CREATED_UTC + FROM comments + WHERE parent_post = $1.id + ORDER BY created_utc desc + LIMIT 1 + $_$;