forked from rDrama/rDrama
schema
parent
ccea00cfe6
commit
1410958ff9
12
schema.sql
12
schema.sql
|
@ -162,11 +162,8 @@ ALTER TABLE public.notifications OWNER TO postgres;
|
||||||
CREATE FUNCTION public.created_utc(public.notifications) RETURNS integer
|
CREATE FUNCTION public.created_utc(public.notifications) RETURNS integer
|
||||||
LANGUAGE sql IMMUTABLE STRICT
|
LANGUAGE sql IMMUTABLE STRICT
|
||||||
AS $_$
|
AS $_$
|
||||||
|
|
||||||
select created_utc from comments
|
select created_utc from comments
|
||||||
|
|
||||||
where comments.id=$1.comment_id
|
where comments.id=$1.comment_id
|
||||||
|
|
||||||
$_$;
|
$_$;
|
||||||
|
|
||||||
|
|
||||||
|
@ -448,15 +445,10 @@ ALTER TABLE public.users OWNER TO postgres;
|
||||||
CREATE FUNCTION public.referral_count(public.users) RETURNS bigint
|
CREATE FUNCTION public.referral_count(public.users) RETURNS bigint
|
||||||
LANGUAGE sql IMMUTABLE STRICT
|
LANGUAGE sql IMMUTABLE STRICT
|
||||||
AS $_$
|
AS $_$
|
||||||
|
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
|
|
||||||
FROM USERS
|
FROM USERS
|
||||||
|
|
||||||
WHERE users.is_banned=0
|
WHERE users.is_banned=0
|
||||||
|
|
||||||
AND users.referred_by=$1.id
|
AND users.referred_by=$1.id
|
||||||
|
|
||||||
$_$;
|
$_$;
|
||||||
|
|
||||||
|
|
||||||
|
@ -469,9 +461,7 @@ ALTER FUNCTION public.referral_count(public.users) OWNER TO postgres;
|
||||||
CREATE FUNCTION public.score(public.comments) RETURNS integer
|
CREATE FUNCTION public.score(public.comments) RETURNS integer
|
||||||
LANGUAGE sql IMMUTABLE STRICT
|
LANGUAGE sql IMMUTABLE STRICT
|
||||||
AS $_$
|
AS $_$
|
||||||
|
|
||||||
SELECT ($1.upvotes - $1.downvotes)
|
SELECT ($1.upvotes - $1.downvotes)
|
||||||
|
|
||||||
$_$;
|
$_$;
|
||||||
|
|
||||||
|
|
||||||
|
@ -484,9 +474,7 @@ ALTER FUNCTION public.score(public.comments) OWNER TO postgres;
|
||||||
CREATE FUNCTION public.score(public.submissions) RETURNS integer
|
CREATE FUNCTION public.score(public.submissions) RETURNS integer
|
||||||
LANGUAGE sql IMMUTABLE STRICT
|
LANGUAGE sql IMMUTABLE STRICT
|
||||||
AS $_$
|
AS $_$
|
||||||
|
|
||||||
SELECT ($1.upvotes - $1.downvotes)
|
SELECT ($1.upvotes - $1.downvotes)
|
||||||
|
|
||||||
$_$;
|
$_$;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue