]> Untitled Git - lemmy.git/blob - migrations/2023-07-06-151124_hot-rank-future/down.sql
detailed error message for blocked domains (#3698) (#3701)
[lemmy.git] / migrations / 2023-07-06-151124_hot-rank-future / down.sql
1 CREATE OR REPLACE FUNCTION hot_rank(score numeric, published timestamp without time zone)
2     RETURNS integer
3     AS $$
4 BEGIN
5     -- hours_diff:=EXTRACT(EPOCH FROM (timezone('utc',now()) - published))/3600
6     RETURN floor(10000 * log(greatest(1, score + 3)) / power(((EXTRACT(EPOCH FROM(timezone('utc', now()) - published)) / 3600) + 2), 1.8))::integer;
7 END;
8 $$
9 LANGUAGE plpgsql
10 IMMUTABLE;
11