diff --git a/schema.sql b/schema.sql index a0895606e..3b979ce89 100644 --- a/schema.sql +++ b/schema.sql @@ -265,6 +265,16 @@ CREATE TABLE public.commentvotes ( ); +-- +-- Name: exiles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.exiles ( + user_id integer NOT NULL, + sub character varying(20) NOT NULL +); + + -- -- Name: flags; Type: TABLE; Schema: public; Owner: - -- @@ -802,6 +812,14 @@ ALTER TABLE ONLY public.banneddomains ADD CONSTRAINT domain_pkey PRIMARY KEY (domain); +-- +-- Name: exiles exiles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.exiles + ADD CONSTRAINT exiles_pkey PRIMARY KEY (user_id, sub); + + -- -- Name: flags flags_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -874,14 +892,6 @@ ALTER TABLE ONLY public.users ADD CONSTRAINT one_discord_account UNIQUE (discord_id); --- --- Name: mods one_mod; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.mods - ADD CONSTRAINT one_mod UNIQUE (user_id, sub); - - -- -- Name: users one_profile_url; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -1009,13 +1019,6 @@ ALTER TABLE ONLY public.votes CREATE UNIQUE INDEX alts_unique_combination ON public.alts USING btree (GREATEST(user1, user2), LEAST(user1, user2)); --- --- Name: alts_user1_idx; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX alts_user1_idx ON public.alts USING btree (user1); - - -- -- Name: alts_user2_idx; Type: INDEX; Schema: public; Owner: - -- @@ -1051,13 +1054,6 @@ CREATE INDEX award_user_idx ON public.award_relationships USING btree (user_id); CREATE INDEX badges_badge_id_idx ON public.badges USING btree (badge_id); --- --- Name: badges_user_index; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX badges_user_index ON public.badges USING btree (user_id); - - -- -- Name: block_target_idx; Type: INDEX; Schema: public; Owner: - -- @@ -1065,13 +1061,6 @@ CREATE INDEX badges_user_index ON public.badges USING btree (user_id); CREATE INDEX block_target_idx ON public.userblocks USING btree (target_id); --- --- Name: block_user_idx; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX block_user_idx ON public.userblocks USING btree (user_id); - - -- -- Name: cflag_user_idx; Type: INDEX; Schema: public; Owner: - -- @@ -1093,13 +1082,6 @@ CREATE INDEX comment_parent_index ON public.comments USING btree (parent_comment CREATE INDEX comment_post_id_index ON public.comments USING btree (parent_submission); --- --- Name: commentflag_comment_index; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX commentflag_comment_index ON public.commentflags USING btree (comment_id); - - -- -- Name: comments_user_index; Type: INDEX; Schema: public; Owner: - -- @@ -1107,13 +1089,6 @@ CREATE INDEX commentflag_comment_index ON public.commentflags USING btree (comme CREATE INDEX comments_user_index ON public.comments USING btree (author_id); --- --- Name: commentvotes_comments_id_index; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX commentvotes_comments_id_index ON public.commentvotes USING btree (comment_id); - - -- -- Name: commentvotes_comments_type_index; Type: INDEX; Schema: public; Owner: - -- @@ -1156,13 +1131,6 @@ CREATE INDEX fki_comment_approver_fkey ON public.comments USING btree (is_approv CREATE INDEX fki_comment_save_relationship_comment_fkey ON public.comment_save_relationship USING btree (comment_id); --- --- Name: fki_comment_save_relationship_user_fkey; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX fki_comment_save_relationship_user_fkey ON public.comment_save_relationship USING btree (user_id); - - -- -- Name: fki_comment_sentto_fkey; Type: INDEX; Schema: public; Owner: - -- @@ -1170,6 +1138,13 @@ CREATE INDEX fki_comment_save_relationship_user_fkey ON public.comment_save_rela CREATE INDEX fki_comment_sentto_fkey ON public.comments USING btree (sentto); +-- +-- Name: fki_exile_sub_fkey; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_exile_sub_fkey ON public.exiles USING btree (sub); + + -- -- Name: fki_mod_sub_fkey; Type: INDEX; Schema: public; Owner: - -- @@ -1191,13 +1166,6 @@ CREATE INDEX fki_modactions_user_fkey ON public.modactions USING btree (target_u CREATE INDEX fki_save_relationship_submission_fkey ON public.save_relationship USING btree (submission_id); --- --- Name: fki_save_relationship_user_fkey; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX fki_save_relationship_user_fkey ON public.save_relationship USING btree (user_id); - - -- -- Name: fki_sub_blocks_sub_fkey; Type: INDEX; Schema: public; Owner: - -- @@ -1205,13 +1173,6 @@ CREATE INDEX fki_save_relationship_user_fkey ON public.save_relationship USING b CREATE INDEX fki_sub_blocks_sub_fkey ON public.sub_blocks USING btree (sub); --- --- Name: fki_sub_blocks_user_fkey; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX fki_sub_blocks_user_fkey ON public.sub_blocks USING btree (user_id); - - -- -- Name: fki_submissions_approver_fkey; Type: INDEX; Schema: public; Owner: - -- @@ -1219,13 +1180,6 @@ CREATE INDEX fki_sub_blocks_user_fkey ON public.sub_blocks USING btree (user_id) CREATE INDEX fki_submissions_approver_fkey ON public.submissions USING btree (is_approved); --- --- Name: fki_subscription_submission_fkey; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX fki_subscription_submission_fkey ON public.subscriptions USING btree (submission_id); - - -- -- Name: fki_user_referrer_fkey; Type: INDEX; Schema: public; Owner: - -- @@ -1233,13 +1187,6 @@ CREATE INDEX fki_subscription_submission_fkey ON public.subscriptions USING btre CREATE INDEX fki_user_referrer_fkey ON public.users USING btree (referred_by); --- --- Name: fki_view_user_fkey; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX fki_view_user_fkey ON public.viewers USING btree (user_id); - - -- -- Name: fki_view_viewer_fkey; Type: INDEX; Schema: public; Owner: - -- @@ -1254,20 +1201,6 @@ CREATE INDEX fki_view_viewer_fkey ON public.viewers USING btree (viewer_id); CREATE INDEX flag_user_idx ON public.flags USING btree (user_id); --- --- Name: flags_post_index; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX flags_post_index ON public.flags USING btree (post_id); - - --- --- Name: follow_target_id_index; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX follow_target_id_index ON public.follows USING btree (target_id); - - -- -- Name: follow_user_id_index; Type: INDEX; Schema: public; Owner: - -- @@ -1324,13 +1257,6 @@ CREATE INDEX modaction_id_idx ON public.modactions USING btree (id DESC); CREATE INDEX modaction_pid_idx ON public.modactions USING btree (target_submission_id); --- --- Name: mods_idx; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX mods_idx ON public.mods USING btree (user_id); - - -- -- Name: notification_read_idx; Type: INDEX; Schema: public; Owner: - -- @@ -1345,13 +1271,6 @@ CREATE INDEX notification_read_idx ON public.notifications USING btree (read); CREATE INDEX notifications_comment_idx ON public.notifications USING btree (comment_id); --- --- Name: notifications_user_index; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX notifications_user_index ON public.notifications USING btree (user_id); - - -- -- Name: notifs_user_read_idx; Type: INDEX; Schema: public; Owner: - -- @@ -1457,13 +1376,6 @@ CREATE INDEX user_banned_idx ON public.users USING btree (is_banned); CREATE INDEX user_private_idx ON public.users USING btree (is_private); --- --- Name: userblocks_both_idx; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX userblocks_both_idx ON public.userblocks USING btree (user_id, target_id); - - -- -- Name: users_created_utc_index; Type: INDEX; Schema: public; Owner: - -- @@ -1506,13 +1418,6 @@ CREATE INDEX users_username_trgm_idx ON public.users USING gin (username public. CREATE INDEX vote_user_index ON public.votes USING btree (user_id); --- --- Name: votes_submission_id_index; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX votes_submission_id_index ON public.votes USING btree (submission_id); - - -- -- Name: votes_type_index; Type: INDEX; Schema: public; Owner: - -- @@ -1688,6 +1593,22 @@ ALTER TABLE ONLY public.commentvotes ADD CONSTRAINT commentvote_user_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); +-- +-- Name: exiles exile_sub_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.exiles + ADD CONSTRAINT exile_sub_fkey FOREIGN KEY (sub) REFERENCES public.subs(name); + + +-- +-- Name: exiles exile_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.exiles + ADD CONSTRAINT exile_user_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); + + -- -- Name: flags flags_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - --