master
Aevann1 2021-07-26 02:17:47 +00:00
parent 0bd3dc222a
commit 046e8e17fc
1 changed files with 111 additions and 582 deletions

View File

@ -16,7 +16,6 @@ SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
ALTER TABLE ONLY public.users DROP CONSTRAINT users_title_fkey;
ALTER TABLE ONLY public.reports DROP CONSTRAINT reports_post_id_fkey;
ALTER TABLE ONLY public.postrels DROP CONSTRAINT postrels_post_id_fkey;
ALTER TABLE ONLY public.notifications DROP CONSTRAINT notifications_comment_id_fkey;
@ -29,21 +28,12 @@ DROP INDEX public.vote_user_index;
DROP INDEX public.vote_created_idx;
DROP INDEX public.users_username_trgm_idx;
DROP INDEX public.users_unbanutc_idx;
DROP INDEX public.users_title_idx;
DROP INDEX public.users_subs_idx;
DROP INDEX public.users_premium_idx;
DROP INDEX public.users_premium_expire_utc_idx;
DROP INDEX public.users_original_username_trgm_idx;
DROP INDEX public.users_neg_idx;
DROP INDEX public.users_karma_idx;
DROP INDEX public.users_created_utc_index;
DROP INDEX public.users_coin_idx;
DROP INDEX public.userblocks_both_idx;
DROP INDEX public.user_private_idx;
DROP INDEX public.user_privacy_idx;
DROP INDEX public.user_ip_idx;
DROP INDEX public.user_del_idx;
DROP INDEX public.user_creation_ip_idx;
DROP INDEX public.user_banned_idx;
DROP INDEX public.trending_all_idx;
DROP INDEX public.subscription_user_index;
@ -161,7 +151,6 @@ ALTER TABLE ONLY public.paypal_txns DROP CONSTRAINT unique_paypalid;
ALTER TABLE ONLY public.oauth_apps DROP CONSTRAINT unique_id;
ALTER TABLE ONLY public.client_auths DROP CONSTRAINT unique_code;
ALTER TABLE ONLY public.client_auths DROP CONSTRAINT unique_access;
ALTER TABLE ONLY public.titles DROP CONSTRAINT titles_pkey;
ALTER TABLE ONLY public.subscriptions DROP CONSTRAINT subscriptions_pkey;
ALTER TABLE ONLY public.submissions DROP CONSTRAINT submissions_pkey;
ALTER TABLE ONLY public.submissions_aux DROP CONSTRAINT submissions_aux_pkey;
@ -219,7 +208,6 @@ ALTER TABLE public.users ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.userflags ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.userblocks ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.useragents ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.titles ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.subscriptions ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.submissions_aux ALTER COLUMN key_id DROP DEFAULT;
ALTER TABLE public.submissions ALTER COLUMN id DROP DEFAULT;
@ -266,8 +254,6 @@ DROP SEQUENCE public.userblocks_id_seq;
DROP TABLE public.userblocks;
DROP SEQUENCE public.useragents_id_seq;
DROP TABLE public.useragents;
DROP SEQUENCE public.titles_id_seq;
DROP TABLE public.titles;
DROP SEQUENCE public.subscriptions_id_seq;
DROP TABLE public.subscriptions;
DROP SEQUENCE public.submissions_id_seq;
@ -346,16 +332,9 @@ DROP FUNCTION public.score(public.submissions);
DROP FUNCTION public.score(public.comments);
DROP FUNCTION public.report_count(public.submissions);
DROP FUNCTION public.referral_count(public.users);
DROP FUNCTION public.rank_hot(public.submissions);
DROP FUNCTION public.rank_hot(public.comments);
DROP FUNCTION public.rank_fiery(public.submissions);
DROP FUNCTION public.rank_fiery(public.comments);
DROP FUNCTION public.rank_best(public.submissions);
DROP FUNCTION public.rank_activity(public.submissions);
DROP FUNCTION public.mod_count(public.users);
DROP FUNCTION public.is_deleted(public.notifications);
DROP FUNCTION public.is_banned(public.notifications);
DROP FUNCTION public.stored_subscriber_count(public.users);
DROP FUNCTION public.flag_count(public.submissions);
DROP FUNCTION public.flag_count(public.comments);
DROP FUNCTION public.energy(public.users);
@ -474,10 +453,8 @@ ALTER TABLE public.comments OWNER TO postgres;
CREATE FUNCTION public.age(public.comments) RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT CAST( EXTRACT( EPOCH FROM CURRENT_TIMESTAMP) AS int) - $1.created_utc
AS $_$
SELECT CAST( EXTRACT( EPOCH FROM CURRENT_TIMESTAMP) AS int) - $1.created_utc
$_$;
@ -539,10 +516,8 @@ ALTER TABLE public.submissions OWNER TO postgres;
CREATE FUNCTION public.age(public.submissions) RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT CAST( EXTRACT( EPOCH FROM CURRENT_TIMESTAMP) AS int) - $1.created_utc
AS $_$
SELECT CAST( EXTRACT( EPOCH FROM CURRENT_TIMESTAMP) AS int) - $1.created_utc
$_$;
@ -560,59 +535,23 @@ CREATE TABLE public.users (
created_utc integer NOT NULL,
admin_level integer,
over_18 boolean,
creation_ip character varying(255),
hide_offensive boolean,
is_activated boolean,
bio character varying(300),
bio_html character varying(1000),
real_id character varying,
referred_by integer,
is_banned integer,
ban_reason character varying(128),
login_nonce integer,
title_id integer,
has_banner boolean NOT NULL,
reserved character varying(256),
is_nsfw boolean NOT NULL,
tos_agreed_utc integer,
profile_nonce integer NOT NULL,
banner_nonce integer NOT NULL,
last_siege_utc integer,
mfa_secret character varying(32),
has_earned_darkmode boolean,
is_private boolean,
read_announcement_utc integer,
feed_nonce integer,
show_nsfl boolean,
karma integer,
comment_karma integer,
unban_utc integer,
is_deleted boolean,
delete_reason character varying(1000),
is_enrolled boolean,
filter_nsfw boolean,
is_nofollow boolean DEFAULT false,
coin_balance integer DEFAULT 0,
premium_expires_utc integer DEFAULT 0,
negative_balance_cents integer DEFAULT 0,
custom_filter_list character varying(1000) DEFAULT ''::character varying,
discord_id character varying(64),
last_yank_utc integer DEFAULT 0,
stored_karma integer DEFAULT 0,
stored_subscriber_count integer DEFAULT 0,
creation_region character(2) DEFAULT NULL::bpchar,
ban_evade integer DEFAULT 0,
profile_upload_ip character varying(255),
banner_upload_ip character varying(255),
profile_upload_region character(2),
banner_upload_region character(2),
name_last_changed_utc integer,
banner_set_utc integer DEFAULT 0,
profile_set_utc integer DEFAULT 0,
original_username character varying(255),
name_changed_utc integer DEFAULT 0,
hide_bot boolean DEFAULT false,
auto_join_chat boolean DEFAULT true,
customtitle text,
defaultsorting text,
defaulttime text,
@ -654,10 +593,8 @@ ALTER TABLE public.users OWNER TO postgres;
CREATE FUNCTION public.age(public.users) RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT CAST( EXTRACT( EPOCH FROM CURRENT_TIMESTAMP) AS int) - $1.created_utc
AS $_$
SELECT CAST( EXTRACT( EPOCH FROM CURRENT_TIMESTAMP) AS int) - $1.created_utc
$_$;
@ -669,14 +606,10 @@ ALTER FUNCTION public.age(public.users) OWNER TO postgres;
CREATE FUNCTION public.board_id(public.comments) RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT submissions.board_id
FROM submissions
WHERE submissions.id=$1.parent_submission
AS $_$
SELECT submissions.board_id
FROM submissions
WHERE submissions.id=$1.parent_submission
$_$;
@ -702,14 +635,10 @@ ALTER TABLE public.reports OWNER TO postgres;
CREATE FUNCTION public.board_id(public.reports) RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT submissions.board_id
FROM submissions
WHERE submissions.id=$1.post_id
AS $_$
SELECT submissions.board_id
FROM submissions
WHERE submissions.id=$1.post_id
$_$;
@ -746,28 +675,17 @@ ALTER FUNCTION public.comment_count(public.submissions) OWNER TO postgres;
CREATE FUNCTION public.comment_energy(public.users) RETURNS bigint
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT COALESCE(
(
SELECT SUM(comments.score_top)
FROM comments
WHERE comments.author_id=$1.id
AND comments.is_banned=false
and comments.parent_submission is not null
),
0
)
AS $_$
SELECT COALESCE(
(
SELECT SUM(comments.score_top)
FROM comments
WHERE comments.author_id=$1.id
AND comments.is_banned=false
and comments.parent_submission is not null
),
0
)
$_$;
@ -797,12 +715,9 @@ ALTER TABLE public.notifications OWNER TO postgres;
CREATE FUNCTION public.created_utc(public.notifications) RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
AS $_$
select created_utc from comments
where comments.id=$1.comment_id
AS $_$
select created_utc from comments
where comments.id=$1.comment_id
$_$;
@ -974,26 +889,16 @@ ALTER FUNCTION public.downs(public.submissions) OWNER TO postgres;
CREATE FUNCTION public.energy(public.users) RETURNS bigint
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT COALESCE(
(
SELECT SUM(submissions.score_top)
FROM submissions
WHERE submissions.author_id=$1.id
AND submissions.is_banned=false
),
0
)
AS $_$
SELECT COALESCE(
(
SELECT SUM(submissions.score_top)
FROM submissions
WHERE submissions.author_id=$1.id
AND submissions.is_banned=false
),
0
)
$_$;
@ -1005,18 +910,12 @@ ALTER FUNCTION public.energy(public.users) OWNER TO postgres;
CREATE FUNCTION public.flag_count(public.comments) RETURNS bigint
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT COUNT(*)
FROM commentflags
JOIN users ON commentflags.user_id=users.id
WHERE comment_id=$1.id
AND users.is_banned=0
AS $_$
SELECT COUNT(*)
FROM commentflags
JOIN users ON commentflags.user_id=users.id
WHERE comment_id=$1.id
AND users.is_banned=0
$_$;
@ -1028,118 +927,26 @@ ALTER FUNCTION public.flag_count(public.comments) OWNER TO postgres;
CREATE FUNCTION public.flag_count(public.submissions) RETURNS bigint
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT COUNT(*)
FROM flags
JOIN users ON flags.user_id=users.id
WHERE post_id=$1.id
AND users.is_banned=0
AS $_$
SELECT COUNT(*)
FROM flags
JOIN users ON flags.user_id=users.id
WHERE post_id=$1.id
AND users.is_banned=0
$_$;
ALTER FUNCTION public.flag_count(public.submissions) OWNER TO postgres;
--
-- Name: stored_subscriber_count(public.users); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION public.stored_subscriber_count(public.users) RETURNS bigint
LANGUAGE sql IMMUTABLE STRICT
AS $_$
select (
(select count(*)
from follows
left join users
on follows.user_id=users.id
where follows.target_id=$1.id
and (users.is_banned=0 or users.created_utc>0)
and users.is_deleted=false
)-(
select count(distinct f1.id)
from
(
select *
from follows
where target_id=$1.id
) as f1
join (select * from users where is_banned=0 or unban_utc>0) as u1
on u1.id=f1.user_id
join (select * from alts) as a
on (a.user1=f1.user_id or a.user2=f1.user_id)
join (
select *
from follows
where target_id=$1.id
) as f2
on ((a.user1=f2.user_id or a.user2=f2.user_id) and f2.id != f1.id)
join (select * from users where is_banned=0 or unban_utc>0) as u2
on u2.id=f2.user_id
where f1.id is not null
and f2.id is not null
)
)
$_$;
ALTER FUNCTION public.stored_subscriber_count(public.users) OWNER TO postgres;
--
-- Name: is_banned(public.notifications); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION public.is_banned(public.notifications) RETURNS boolean
LANGUAGE sql IMMUTABLE STRICT
AS $_$
select is_banned from comments
where comments.id=$1.comment_id
AS $_$
select is_banned from comments
where comments.id=$1.comment_id
$_$;
@ -1151,12 +958,9 @@ ALTER FUNCTION public.is_banned(public.notifications) OWNER TO postgres;
CREATE FUNCTION public.is_deleted(public.notifications) RETURNS boolean
LANGUAGE sql IMMUTABLE STRICT
AS $_$
select is_deleted from comments
where comments.id=$1.comment_id
AS $_$
select is_deleted from comments
where comments.id=$1.comment_id
$_$;
@ -1173,112 +977,17 @@ CREATE FUNCTION public.mod_count(public.users) RETURNS bigint
ALTER FUNCTION public.mod_count(public.users) OWNER TO postgres;
--
-- Name: rank_activity(public.submissions); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION public.rank_activity(public.submissions) RETURNS double precision
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT 1000000.0*CAST($1.comment_count AS float)/((CAST(($1.age+5000) AS FLOAT)/100.0)^(1.35))
$_$;
ALTER FUNCTION public.rank_activity(public.submissions) OWNER TO postgres;
--
-- Name: rank_best(public.submissions); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION public.rank_best(public.submissions) RETURNS double precision
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT 10000000.0*CAST(($1.upvotes - $1.downvotes + 1) AS float)/((CAST(($1.age+3600) AS FLOAT)*cast((select boards.subscriber_count from boards where boards.id=$1.board_id)+10000 as float)/1000.0)^(1.35))
$_$;
ALTER FUNCTION public.rank_best(public.submissions) OWNER TO postgres;
--
-- Name: rank_fiery(public.comments); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION public.rank_fiery(public.comments) RETURNS double precision
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT SQRT(CAST(($1.upvotes * $1.downvotes) AS float))
$_$;
ALTER FUNCTION public.rank_fiery(public.comments) OWNER TO postgres;
--
-- Name: rank_fiery(public.submissions); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION public.rank_fiery(public.submissions) RETURNS double precision
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT 1000000.0*SQRT(CAST(($1.upvotes * $1.downvotes) AS float))/((CAST(($1.age+5000) AS FLOAT)/100.0)^(1.35))
$_$;
ALTER FUNCTION public.rank_fiery(public.submissions) OWNER TO postgres;
--
-- Name: rank_hot(public.comments); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION public.rank_hot(public.comments) RETURNS double precision
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT CAST(($1.upvotes - $1.downvotes) AS float)/((CAST(($1.age+100000) AS FLOAT)/6.0)^(1.5))
$_$;
ALTER FUNCTION public.rank_hot(public.comments) OWNER TO postgres;
--
-- Name: rank_hot(public.submissions); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION public.rank_hot(public.submissions) RETURNS double precision
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT 1000000.0*CAST(($1.upvotes - $1.downvotes) AS float)/((CAST(($1.age+5000) AS FLOAT)/100.0)^(1.5))
$_$;
ALTER FUNCTION public.rank_hot(public.submissions) OWNER TO postgres;
--
-- Name: referral_count(public.users); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION public.referral_count(public.users) RETURNS bigint
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT COUNT(*)
FROM USERS
WHERE users.is_banned=0
AND users.referred_by=$1.id
AS $_$
SELECT COUNT(*)
FROM USERS
WHERE users.is_banned=0
AND users.referred_by=$1.id
$_$;
@ -1290,20 +999,13 @@ ALTER FUNCTION public.referral_count(public.users) OWNER TO postgres;
CREATE FUNCTION public.report_count(public.submissions) RETURNS bigint
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT COUNT(*)
FROM reports
JOIN users ON reports.user_id=users.id
WHERE post_id=$1.id
AND users.is_banned=0
and reports.created_utc >= $1.edited_utc
AS $_$
SELECT COUNT(*)
FROM reports
JOIN users ON reports.user_id=users.id
WHERE post_id=$1.id
AND users.is_banned=0
and reports.created_utc >= $1.edited_utc
$_$;
@ -1315,10 +1017,8 @@ ALTER FUNCTION public.report_count(public.submissions) OWNER TO postgres;
CREATE FUNCTION public.score(public.comments) RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT ($1.upvotes - $1.downvotes)
AS $_$
SELECT ($1.upvotes - $1.downvotes)
$_$;
@ -1330,10 +1030,8 @@ ALTER FUNCTION public.score(public.comments) OWNER TO postgres;
CREATE FUNCTION public.score(public.submissions) RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT ($1.upvotes - $1.downvotes)
AS $_$
SELECT ($1.upvotes - $1.downvotes)
$_$;
@ -1371,18 +1069,12 @@ ALTER TABLE public.images OWNER TO postgres;
CREATE FUNCTION public.splash(text) RETURNS SETOF public.images
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT *
FROM images
WHERE state=$1
ORDER BY random()
LIMIT 1
AS $_$
SELECT *
FROM images
WHERE state=$1
ORDER BY random()
LIMIT 1
$_$;
@ -1548,72 +1240,39 @@ ALTER FUNCTION public.ups(public.submissions) OWNER TO postgres;
CREATE FUNCTION public.ups_test(public.submissions) RETURNS bigint
LANGUAGE sql IMMUTABLE STRICT
AS $_$
select (
(
SELECT count(*)
from (
select * from votes
where submission_id=$1.id
and vote_type=1
) as v1
join (select * from users where users.is_banned=0) as u0
on u0.id=v1.user_id
)-(
SELECT count(distinct v1.id)
from (
select * from votes
where submission_id=$1.id
and vote_type=1
) as v1
join (select * from users where is_banned=0) as u1
on u1.id=v1.user_id
join (select * from alts) as a
on (a.user1=v1.user_id or a.user2=v1.user_id)
join (
select * from votes
where submission_id=$1.id
and vote_type=1
) as v2
on ((a.user1=v2.id or a.user2=v2.id) and v2.id != v1.id)
join (select * from users where is_banned=0) as u2
on u2.id=v2.user_id
where v1.id is not null
and v2.id is not null
))
AS $_$
select (
(
SELECT count(*)
from (
select * from votes
where submission_id=$1.id
and vote_type=1
) as v1
join (select * from users where users.is_banned=0) as u0
on u0.id=v1.user_id
)-(
SELECT count(distinct v1.id)
from (
select * from votes
where submission_id=$1.id
and vote_type=1
) as v1
join (select * from users where is_banned=0) as u1
on u1.id=v1.user_id
join (select * from alts) as a
on (a.user1=v1.user_id or a.user2=v1.user_id)
join (
select * from votes
where submission_id=$1.id
and vote_type=1
) as v2
on ((a.user1=v2.id or a.user2=v2.id) and v2.id != v1.id)
join (select * from users where is_banned=0) as u2
on u2.id=v2.user_id
where v1.id is not null
and v2.id is not null
))
$_$;
@ -2904,50 +2563,6 @@ ALTER TABLE public.subscriptions_id_seq OWNER TO postgres;
ALTER SEQUENCE public.subscriptions_id_seq OWNED BY public.subscriptions.id;
--
-- Name: titles; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.titles (
id integer NOT NULL,
is_before boolean NOT NULL,
text character varying(64),
qualification_expr character varying(256),
requirement_string character varying(512),
color character varying(6),
kind integer,
background_color_1 character varying(8),
background_color_2 character varying(8),
gradient_angle integer,
box_shadow_color character varying(32),
text_shadow_color character varying(32)
);
ALTER TABLE public.titles OWNER TO postgres;
--
-- Name: titles_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.titles_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.titles_id_seq OWNER TO postgres;
--
-- Name: titles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.titles_id_seq OWNED BY public.titles.id;
--
-- Name: useragents; Type: TABLE; Schema: public; Owner: postgres
--
@ -3400,13 +3015,6 @@ ALTER TABLE ONLY public.submissions_aux ALTER COLUMN key_id SET DEFAULT nextval(
ALTER TABLE ONLY public.subscriptions ALTER COLUMN id SET DEFAULT nextval('public.subscriptions_id_seq'::regclass);
--
-- Name: titles id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.titles ALTER COLUMN id SET DEFAULT nextval('public.titles_id_seq'::regclass);
--
-- Name: useragents id; Type: DEFAULT; Schema: public; Owner: postgres
--
@ -3857,14 +3465,6 @@ ALTER TABLE ONLY public.subscriptions
ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id);
--
-- Name: titles titles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.titles
ADD CONSTRAINT titles_pkey PRIMARY KEY (id);
--
-- Name: client_auths unique_access; Type: CONSTRAINT; Schema: public; Owner: postgres
--
@ -4702,27 +4302,6 @@ CREATE INDEX trending_all_idx ON public.submissions USING btree (is_banned, dele
CREATE INDEX user_banned_idx ON public.users USING btree (is_banned);
--
-- Name: user_creation_ip_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX user_creation_ip_idx ON public.users USING btree (creation_ip);
--
-- Name: user_del_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX user_del_idx ON public.users USING btree (is_deleted);
--
-- Name: user_ip_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX user_ip_idx ON public.users USING btree (creation_ip);
--
-- Name: user_privacy_idx; Type: INDEX; Schema: public; Owner: postgres
--
@ -4744,13 +4323,6 @@ CREATE INDEX user_private_idx ON public.users USING btree (is_private);
CREATE INDEX userblocks_both_idx ON public.userblocks USING btree (user_id, target_id);
--
-- Name: users_coin_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX users_coin_idx ON public.users USING btree (coin_balance);
--
-- Name: users_created_utc_index; Type: INDEX; Schema: public; Owner: postgres
--
@ -4758,20 +4330,6 @@ CREATE INDEX users_coin_idx ON public.users USING btree (coin_balance);
CREATE INDEX users_created_utc_index ON public.users USING btree (created_utc);
--
-- Name: users_karma_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX users_karma_idx ON public.users USING btree (stored_karma);
--
-- Name: users_neg_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX users_neg_idx ON public.users USING btree (negative_balance_cents);
--
-- Name: users_original_username_trgm_idx; Type: INDEX; Schema: public; Owner: postgres
--
@ -4779,20 +4337,6 @@ CREATE INDEX users_neg_idx ON public.users USING btree (negative_balance_cents);
CREATE INDEX users_original_username_trgm_idx ON public.users USING gin (original_username public.gin_trgm_ops);
--
-- Name: users_premium_expire_utc_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX users_premium_expire_utc_idx ON public.users USING btree (premium_expires_utc DESC);
--
-- Name: users_premium_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX users_premium_idx ON public.users USING btree (premium_expires_utc);
--
-- Name: users_subs_idx; Type: INDEX; Schema: public; Owner: postgres
--
@ -4800,13 +4344,6 @@ CREATE INDEX users_premium_idx ON public.users USING btree (premium_expires_utc)
CREATE INDEX users_subs_idx ON public.users USING btree (stored_subscriber_count);
--
-- Name: users_title_idx; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX users_title_idx ON public.users USING btree (title_id);
--
-- Name: users_unbanutc_idx; Type: INDEX; Schema: public; Owner: postgres
--
@ -4897,14 +4434,6 @@ ALTER TABLE ONLY public.reports
ADD CONSTRAINT reports_post_id_fkey FOREIGN KEY (post_id) REFERENCES public.submissions(id);
--
-- Name: users users_title_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_title_fkey FOREIGN KEY (title_id) REFERENCES public.titles(id);
--
-- PostgreSQL database dump complete
--