From aafc06ed6489e1654c5033bcaae704f428cacfbd Mon Sep 17 00:00:00 2001 From: atrc445 Date: Tue, 28 Sep 2021 22:54:33 +0200 Subject: [PATCH] add removing follows --- files/classes/comment.py | 1 + files/routes/users.py | 23 + files/templates/followers.html | 15 + schema.sql | 1496 +++++++++++++++++++++----------- seed-db.sql | 50 +- 5 files changed, 1066 insertions(+), 519 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 4408410bc..9dd32f24e 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -347,6 +347,7 @@ class Notification(Base): read = Column(Boolean, default=False) followsender = Column(Integer) unfollowsender = Column(Integer) + removefollowsender = Column(Integer) blocksender = Column(Integer) unblocksender = Column(Integer) diff --git a/files/routes/users.py b/files/routes/users.py index 7ce77623c..d43d78045 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -672,6 +672,29 @@ def unfollow_user(username, v): return {"message": "User unfollowed!"} +@app.post("/remove_follow/") +@auth_required +def remove_follow(username, v): + target = get_user(username) + + # check for existing follow + follow = g.db.query(Follow).options(lazyload('*')).filter_by(user_id=target.id, target_id=v.id).first() + + if not follow: return {"message": "Follower removed!"} + + g.db.delete(follow) + + g.db.flush() + v.stored_subscriber_count = g.db.query(Follow.id).options(lazyload('*')).filter_by(target_id=v.id).count() + g.db.add(v) + + existing = g.db.query(Notification).options(lazyload('*')).filter_by(removefollowsender=v.id, user_id=target.id).first() + if not existing: send_unfollow_notif(v.id, target.id, f"@{v.username} has removed your follow!") + + g.db.commit() + + return {"message": "Follower removed!"} + @app.route("/uid//pic/profile") @limiter.exempt diff --git a/files/templates/followers.html b/files/templates/followers.html index 5e33e710a..912cd11b7 100644 --- a/files/templates/followers.html +++ b/files/templates/followers.html @@ -1,5 +1,12 @@ {% extends "default.html" %} {% block content %} +

 
@{{u.username}}'s followers

@@ -8,14 +15,22 @@
 	
 		#
 		Name
+		{% if v.id == u.id %}
+			
+		{% endif %}
 	
 
+
 {% for user in users %}
 	
 		{{loop.index}}
 		{{user.username}}
+		{% if v.id == u.id %}
+		
Remove follow
+ {% endif %} {% endfor %} + {% endblock %} \ No newline at end of file diff --git a/schema.sql b/schema.sql index 15bbc1c93..7d8f471cd 100644 --- a/schema.sql +++ b/schema.sql @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 13.4 --- Dumped by pg_dump version 13.4 (Ubuntu 13.4-1.pgdg20.04+1) +-- Dumped from database version 10.18 (Ubuntu 10.18-1.pgdg20.04+1) +-- Dumped by pg_dump version 10.18 (Ubuntu 10.18-1.pgdg20.04+1) SET statement_timeout = 0; SET lock_timeout = 0; @@ -16,43 +16,280 @@ SET xmloption = content; SET client_min_messages = warning; SET row_security = off; +ALTER TABLE IF EXISTS ONLY public.notifications DROP CONSTRAINT IF EXISTS notifications_comment_id_fkey; +ALTER TABLE IF EXISTS ONLY public.flags DROP CONSTRAINT IF EXISTS flags_post_id_fkey; +ALTER TABLE IF EXISTS ONLY public.commentflags DROP CONSTRAINT IF EXISTS commentflags_comment_id_fkey; +ALTER TABLE IF EXISTS ONLY public.badges DROP CONSTRAINT IF EXISTS badges_badge_id_fkey; +DROP INDEX IF EXISTS public.votes_type_index; +DROP INDEX IF EXISTS public.votes_submission_id_index; +DROP INDEX IF EXISTS public.vote_user_index; +DROP INDEX IF EXISTS public.users_username_trgm_idx; +DROP INDEX IF EXISTS public.users_unbanutc_idx; +DROP INDEX IF EXISTS public.users_subs_idx; +DROP INDEX IF EXISTS public.users_original_username_trgm_idx; +DROP INDEX IF EXISTS public.users_created_utc_index; +DROP INDEX IF EXISTS public.userblocks_both_idx; +DROP INDEX IF EXISTS public.user_private_idx; +DROP INDEX IF EXISTS public.user_privacy_idx; +DROP INDEX IF EXISTS public.user_banned_idx; +DROP INDEX IF EXISTS public.subscription_user_index; +DROP INDEX IF EXISTS public.subscription_board_index; +DROP INDEX IF EXISTS public.submissions_score_idx; +DROP INDEX IF EXISTS public.submissions_over18_index; +DROP INDEX IF EXISTS public.submissions_offensive_index; +DROP INDEX IF EXISTS public.submissions_created_utc_desc_idx; +DROP INDEX IF EXISTS public.submissions_author_index; +DROP INDEX IF EXISTS public.submission_purge_idx; +DROP INDEX IF EXISTS public.submission_pinned_idx; +DROP INDEX IF EXISTS public.submission_new_sort_idx; +DROP INDEX IF EXISTS public.submission_isdeleted_idx; +DROP INDEX IF EXISTS public.submission_isbanned_idx; +DROP INDEX IF EXISTS public.submission_hot_sort_idx; +DROP INDEX IF EXISTS public.submission_domainref_index; +DROP INDEX IF EXISTS public.submission_disputed_sort_idx; +DROP INDEX IF EXISTS public.submission_best_only_idx; +DROP INDEX IF EXISTS public.subimssion_binary_group_idx; +DROP INDEX IF EXISTS public.sub_user_index; +DROP INDEX IF EXISTS public.post_public_idx; +DROP INDEX IF EXISTS public.post_offensive_index; +DROP INDEX IF EXISTS public.post_author_index; +DROP INDEX IF EXISTS public.post_app_id_idx; +DROP INDEX IF EXISTS public.post_18_index; +DROP INDEX IF EXISTS public.notifs_user_read_idx; +DROP INDEX IF EXISTS public.notifications_user_index; +DROP INDEX IF EXISTS public.notifications_comment_idx; +DROP INDEX IF EXISTS public.notification_read_idx; +DROP INDEX IF EXISTS public.modaction_pid_idx; +DROP INDEX IF EXISTS public.modaction_id_idx; +DROP INDEX IF EXISTS public.modaction_cid_idx; +DROP INDEX IF EXISTS public.modaction_action_idx; +DROP INDEX IF EXISTS public.follow_user_id_index; +DROP INDEX IF EXISTS public.follow_target_id_index; +DROP INDEX IF EXISTS public.flags_post_index; +DROP INDEX IF EXISTS public.flag_user_idx; +DROP INDEX IF EXISTS public.domains_domain_trgm_idx; +DROP INDEX IF EXISTS public.domain_ref_idx; +DROP INDEX IF EXISTS public.discord_id_idx; +DROP INDEX IF EXISTS public.cvote_user_index; +DROP INDEX IF EXISTS public.commentvotes_comments_type_index; +DROP INDEX IF EXISTS public.commentvotes_comments_id_index; +DROP INDEX IF EXISTS public.comments_user_index; +DROP INDEX IF EXISTS public.comments_parent_id_idx; +DROP INDEX IF EXISTS public.commentflag_comment_index; +DROP INDEX IF EXISTS public.comment_post_id_index; +DROP INDEX IF EXISTS public.comment_parent_index; +DROP INDEX IF EXISTS public.cflag_user_idx; +DROP INDEX IF EXISTS public.block_user_idx; +DROP INDEX IF EXISTS public.block_target_idx; +DROP INDEX IF EXISTS public.badpics_phash_index; +DROP INDEX IF EXISTS public.badpic_phash_trgm_idx; +DROP INDEX IF EXISTS public.badpic_phash_idx; +DROP INDEX IF EXISTS public.badlink_link_idx; +DROP INDEX IF EXISTS public.badges_user_index; +DROP INDEX IF EXISTS public.badges_badge_id_idx; +DROP INDEX IF EXISTS public.badgedef_qual_idx; +DROP INDEX IF EXISTS public.award_user_idx; +DROP INDEX IF EXISTS public.award_post_idx; +DROP INDEX IF EXISTS public.award_comment_idx; +DROP INDEX IF EXISTS public.alts_user2_idx; +DROP INDEX IF EXISTS public.alts_user1_idx; +ALTER TABLE IF EXISTS ONLY public.votes DROP CONSTRAINT IF EXISTS votes_pkey; +ALTER TABLE IF EXISTS ONLY public.viewers DROP CONSTRAINT IF EXISTS viewers_pkey; +ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT IF EXISTS users_username_key; +ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT IF EXISTS users_pkey; +ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT IF EXISTS users_original_username_key; +ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT IF EXISTS users_email_key; +ALTER TABLE IF EXISTS ONLY public.alts DROP CONSTRAINT IF EXISTS userpair; +ALTER TABLE IF EXISTS ONLY public.userblocks DROP CONSTRAINT IF EXISTS userblocks_pkey; +ALTER TABLE IF EXISTS ONLY public.badges DROP CONSTRAINT IF EXISTS user_badge_constraint; +ALTER TABLE IF EXISTS ONLY public.oauth_apps DROP CONSTRAINT IF EXISTS unique_id; +ALTER TABLE IF EXISTS ONLY public.client_auths DROP CONSTRAINT IF EXISTS unique_access; +ALTER TABLE IF EXISTS ONLY public.subscriptions DROP CONSTRAINT IF EXISTS subscriptions_pkey; +ALTER TABLE IF EXISTS ONLY public.submissions DROP CONSTRAINT IF EXISTS submissions_pkey; +ALTER TABLE IF EXISTS ONLY public.save_relationship DROP CONSTRAINT IF EXISTS save_relationship_pkey; +ALTER TABLE IF EXISTS ONLY public.save_relationship DROP CONSTRAINT IF EXISTS save_constraint; +ALTER TABLE IF EXISTS ONLY public.votes DROP CONSTRAINT IF EXISTS onevote; +ALTER TABLE IF EXISTS ONLY public.commentvotes DROP CONSTRAINT IF EXISTS onecvote; +ALTER TABLE IF EXISTS ONLY public.notifications DROP CONSTRAINT IF EXISTS one_notif; +ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT IF EXISTS one_discord_account; +ALTER TABLE IF EXISTS ONLY public.oauth_apps DROP CONSTRAINT IF EXISTS oauth_apps_pkey; +ALTER TABLE IF EXISTS ONLY public.notifications DROP CONSTRAINT IF EXISTS notifications_pkey; +ALTER TABLE IF EXISTS ONLY public.modactions DROP CONSTRAINT IF EXISTS modactions_pkey; +ALTER TABLE IF EXISTS ONLY public.images DROP CONSTRAINT IF EXISTS images_pkey; +ALTER TABLE IF EXISTS ONLY public.subscriptions DROP CONSTRAINT IF EXISTS guild_membership_unique; +ALTER TABLE IF EXISTS ONLY public.follows DROP CONSTRAINT IF EXISTS follows_pkey; +ALTER TABLE IF EXISTS ONLY public.follows DROP CONSTRAINT IF EXISTS follow_membership_unique; +ALTER TABLE IF EXISTS ONLY public.flags DROP CONSTRAINT IF EXISTS flags_pkey; +ALTER TABLE IF EXISTS ONLY public.banneddomains DROP CONSTRAINT IF EXISTS domains_pkey; +ALTER TABLE IF EXISTS ONLY public.banneddomains DROP CONSTRAINT IF EXISTS domains_domain_key; +ALTER TABLE IF EXISTS ONLY public.commentvotes DROP CONSTRAINT IF EXISTS commentvotes_pkey; +ALTER TABLE IF EXISTS ONLY public.comments DROP CONSTRAINT IF EXISTS comments_pkey; +ALTER TABLE IF EXISTS ONLY public.commentflags DROP CONSTRAINT IF EXISTS commentflags_pkey; +ALTER TABLE IF EXISTS ONLY public.client_auths DROP CONSTRAINT IF EXISTS client_auths_pkey; +ALTER TABLE IF EXISTS ONLY public.badpics DROP CONSTRAINT IF EXISTS badpics_pkey; +ALTER TABLE IF EXISTS ONLY public.badlinks DROP CONSTRAINT IF EXISTS badlinks_pkey; +ALTER TABLE IF EXISTS ONLY public.badges DROP CONSTRAINT IF EXISTS badges_pkey; +ALTER TABLE IF EXISTS ONLY public.badge_defs DROP CONSTRAINT IF EXISTS badge_list_icon_key; +ALTER TABLE IF EXISTS ONLY public.badge_defs DROP CONSTRAINT IF EXISTS badge_defs_pkey; +ALTER TABLE IF EXISTS ONLY public.award_relationships DROP CONSTRAINT IF EXISTS award_relationships_pkey; +ALTER TABLE IF EXISTS ONLY public.award_relationships DROP CONSTRAINT IF EXISTS award_constraint; +ALTER TABLE IF EXISTS ONLY public.alts DROP CONSTRAINT IF EXISTS alts_pkey; +ALTER TABLE IF EXISTS public.votes ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.viewers ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.users ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.userblocks ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.subscriptions ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.submissions ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.save_relationship ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.oauth_apps ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.notifications ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.modactions ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.images ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.follows ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.flags ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.commentvotes ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.comments ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.commentflags ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.client_auths ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.banneddomains ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.badpics ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.badlinks ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.badges ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.badge_defs ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.award_relationships ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS public.alts ALTER COLUMN id DROP DEFAULT; +DROP SEQUENCE IF EXISTS public.votes_id_seq; +DROP TABLE IF EXISTS public.votes; +DROP SEQUENCE IF EXISTS public.viewers_id_seq; +DROP TABLE IF EXISTS public.viewers; +DROP SEQUENCE IF EXISTS public.users_id_seq; +DROP TABLE IF EXISTS public.users; +DROP SEQUENCE IF EXISTS public.userblocks_id_seq; +DROP TABLE IF EXISTS public.userblocks; +DROP SEQUENCE IF EXISTS public.subscriptions_id_seq; +DROP TABLE IF EXISTS public.subscriptions; +DROP SEQUENCE IF EXISTS public.submissions_id_seq; +DROP SEQUENCE IF EXISTS public.save_relationship_id_seq; +DROP TABLE IF EXISTS public.save_relationship; +DROP SEQUENCE IF EXISTS public.oauth_apps_id_seq; +DROP TABLE IF EXISTS public.oauth_apps; +DROP SEQUENCE IF EXISTS public.notifications_id_seq; +DROP TABLE IF EXISTS public.notifications; +DROP SEQUENCE IF EXISTS public.modactions_id_seq; +DROP TABLE IF EXISTS public.modactions; +DROP SEQUENCE IF EXISTS public.images_id_seq; +DROP TABLE IF EXISTS public.images; +DROP SEQUENCE IF EXISTS public.follows_id_seq; +DROP TABLE IF EXISTS public.follows; +DROP SEQUENCE IF EXISTS public.flags_id_seq; +DROP TABLE IF EXISTS public.flags; +DROP SEQUENCE IF EXISTS public.domains_id_seq; +DROP SEQUENCE IF EXISTS public.commentvotes_id_seq; +DROP TABLE IF EXISTS public.commentvotes; +DROP SEQUENCE IF EXISTS public.comments_id_seq; +DROP SEQUENCE IF EXISTS public.commentflags_id_seq; +DROP TABLE IF EXISTS public.commentflags; +DROP SEQUENCE IF EXISTS public.client_auths_id_seq; +DROP TABLE IF EXISTS public.client_auths; +DROP TABLE IF EXISTS public.banneddomains; +DROP SEQUENCE IF EXISTS public.badpics_id_seq; +DROP TABLE IF EXISTS public.badpics; +DROP SEQUENCE IF EXISTS public.badlinks_id_seq; +DROP TABLE IF EXISTS public.badlinks; +DROP SEQUENCE IF EXISTS public.badges_id_seq; +DROP TABLE IF EXISTS public.badges; +DROP SEQUENCE IF EXISTS public.badge_list_id_seq; +DROP TABLE IF EXISTS public.badge_defs; +DROP SEQUENCE IF EXISTS public.award_relationships_id_seq; +DROP TABLE IF EXISTS public.award_relationships; +DROP SEQUENCE IF EXISTS public.alts_id_seq; +DROP TABLE IF EXISTS public.alts; +DROP FUNCTION IF EXISTS public.score_disputed(public.comments); +DROP FUNCTION IF EXISTS public.score(public.submissions); +DROP FUNCTION IF EXISTS public.score(public.comments); +DROP TABLE IF EXISTS public.comments; +DROP FUNCTION IF EXISTS public.hotscore(public.submissions); +DROP FUNCTION IF EXISTS public.age(public.submissions); +DROP TABLE IF EXISTS public.submissions; +DROP EXTENSION IF EXISTS pg_trgm; +DROP EXTENSION IF EXISTS pg_stat_statements; +DROP EXTENSION IF EXISTS fuzzystrmatch; +DROP EXTENSION IF EXISTS plpgsql; +DROP SCHEMA IF EXISTS public; -- --- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: - +-- Name: DATABASE postgres; Type: COMMENT; Schema: -; Owner: postgres +-- + +COMMENT ON DATABASE postgres IS 'default administrative connection database'; + + +-- +-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres +-- + +CREATE SCHEMA public; + + +ALTER SCHEMA public OWNER TO postgres; + +-- +-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres +-- + +COMMENT ON SCHEMA public IS 'standard public schema'; + + +-- +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: +-- + +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; + + +-- +-- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: -- CREATE EXTENSION IF NOT EXISTS fuzzystrmatch WITH SCHEMA public; -- --- Name: EXTENSION fuzzystrmatch; Type: COMMENT; Schema: -; Owner: - +-- Name: EXTENSION fuzzystrmatch; Type: COMMENT; Schema: -; Owner: -- COMMENT ON EXTENSION fuzzystrmatch IS 'determine similarities and distance between strings'; -- --- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - +-- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: -- CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA public; -- --- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner: - +-- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner: -- -COMMENT ON EXTENSION pg_stat_statements IS 'track planning and execution statistics of all SQL statements executed'; +COMMENT ON EXTENSION pg_stat_statements IS 'track execution statistics of all SQL statements executed'; -- --- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: - +-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -- CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public; -- --- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: - +-- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: -- COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams'; @@ -60,282 +297,93 @@ COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching SET default_tablespace = ''; -SET default_table_access_method = heap; +SET default_with_oids = false; -- --- Name: alts; Type: TABLE; Schema: public; Owner: - +-- Name: submissions; Type: TABLE; Schema: public; Owner: postgres -- -CREATE TABLE public.alts ( +CREATE TABLE public.submissions ( id integer NOT NULL, - user1 integer NOT NULL, - user2 integer NOT NULL, - is_manual boolean DEFAULT false + author_id integer, + created_utc integer NOT NULL, + is_banned boolean, + over_18 boolean, + distinguish_level integer, + created_str character varying(255), + deleted_utc integer NOT NULL, + domain_ref integer, + is_approved integer NOT NULL, + approved_utc integer, + edited_utc integer, + mod_approved integer, + has_thumb boolean, + accepted_utc integer, + post_public boolean, + score_hot double precision, + score_top integer, + score_activity double precision, + score_disputed double precision, + is_offensive boolean, + is_pinned boolean, + is_nsfl boolean, + repost_id integer, + score_best double precision, + upvotes integer, + downvotes integer, + app_id integer, + creation_region character(2) DEFAULT NULL::bpchar, + purged_utc integer DEFAULT 0, + is_bot boolean DEFAULT false, + thumburl text, + private boolean, + views integer, + banaward text, + bannedfor boolean, + comment_count integer DEFAULT 0, + processing boolean DEFAULT false, + removed_by integer, + club boolean, + title character varying(500), + url character varying(2083), + body character varying(10000), + body_html character varying(20000), + embed_url character varying(10000), + ban_reason character varying(128), + title_html text, + stickied text ); --- --- Name: alts_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.alts_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - +ALTER TABLE public.submissions OWNER TO postgres; -- --- Name: alts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: age(public.submissions); Type: FUNCTION; Schema: public; Owner: postgres -- -ALTER SEQUENCE public.alts_id_seq OWNED BY public.alts.id; +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 $_$; +ALTER FUNCTION public.age(public.submissions) OWNER TO postgres; + -- --- Name: award_relationships; Type: TABLE; Schema: public; Owner: - +-- Name: hotscore(public.submissions); Type: FUNCTION; Schema: public; Owner: postgres -- -CREATE TABLE public.award_relationships ( - id integer NOT NULL, - user_id integer, - submission_id integer, - comment_id integer, - kind character varying(20) -); +CREATE FUNCTION public.hotscore(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)/1000.0)^(1.35)) + $_$; +ALTER FUNCTION public.hotscore(public.submissions) OWNER TO postgres; + -- --- Name: award_relationships_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.award_relationships_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: award_relationships_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.award_relationships_id_seq OWNED BY public.award_relationships.id; - - --- --- Name: badge_defs; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.badge_defs ( - id integer NOT NULL, - name character varying(64), - description character varying(256), - icon character varying(64), - kind integer, - qualification_expr character varying(128) -); - - --- --- Name: badge_list_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.badge_list_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: badge_list_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.badge_list_id_seq OWNED BY public.badge_defs.id; - - --- --- Name: badges; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.badges ( - id integer NOT NULL, - badge_id integer, - user_id integer, - description character varying(256), - url character varying(256) -); - - --- --- Name: badges_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.badges_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: badges_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.badges_id_seq OWNED BY public.badges.id; - - --- --- Name: badlinks; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.badlinks ( - id integer NOT NULL, - reason text, - link character varying(512), - autoban boolean -); - - --- --- Name: badlinks_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.badlinks_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: badlinks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.badlinks_id_seq OWNED BY public.badlinks.id; - - --- --- Name: badpics; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.badpics ( - id integer NOT NULL, - description character varying(255), - phash character varying(64), - ban_reason character varying(64), - ban_time integer DEFAULT 0 NOT NULL -); - - --- --- Name: badpics_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.badpics_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: badpics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.badpics_id_seq OWNED BY public.badpics.id; - - --- --- Name: banneddomains; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.banneddomains ( - id integer NOT NULL, - domain character varying(100), - reason text -); - - --- --- Name: client_auths; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.client_auths ( - id integer NOT NULL, - user_id integer, - oauth_client integer, - access_token character(128) -); - - --- --- Name: client_auths_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.client_auths_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: client_auths_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.client_auths_id_seq OWNED BY public.client_auths.id; - - --- --- Name: commentflags; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.commentflags ( - id integer NOT NULL, - user_id integer, - comment_id integer, - reason text -); - - --- --- Name: commentflags_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.commentflags_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: commentflags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.commentflags_id_seq OWNED BY public.commentflags.id; - - --- --- Name: comments; Type: TABLE; Schema: public; Owner: - +-- Name: comments; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.comments ( @@ -344,6 +392,7 @@ CREATE TABLE public.comments ( created_utc integer NOT NULL, parent_submission integer, is_banned boolean, + parent_fullname character varying(255), distinguish_level integer, edited_utc integer, deleted_utc integer NOT NULL, @@ -358,17 +407,375 @@ CREATE TABLE public.comments ( is_bot boolean DEFAULT false, app_id integer, sentto integer, + shadowbanned boolean, + banaward text, bannedfor boolean, removed_by integer, + body character varying(10000), + body_html character varying(20000), + ban_reason character varying(256), is_pinned text, - body character varying(20000), - body_html character varying(40000), - ban_reason character varying(256) + notifiedto integer ); +ALTER TABLE public.comments OWNER TO postgres; + -- --- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: score(public.comments); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION public.score(public.comments) RETURNS integer + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT $1.upvotes - $1.downvotes + $_$; + + +ALTER FUNCTION public.score(public.comments) OWNER TO postgres; + +-- +-- Name: score(public.submissions); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION public.score(public.submissions) RETURNS integer + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT $1.upvotes - $1.downvotes + $_$; + + +ALTER FUNCTION public.score(public.submissions) OWNER TO postgres; + +-- +-- Name: score_disputed(public.comments); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION public.score_disputed(public.comments) RETURNS integer + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT $1.upvotes * $1.downvotes + $_$; + + +ALTER FUNCTION public.score_disputed(public.comments) OWNER TO postgres; + +-- +-- Name: alts; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.alts ( + id integer NOT NULL, + user1 integer NOT NULL, + user2 integer NOT NULL, + is_manual boolean DEFAULT false +); + + +ALTER TABLE public.alts OWNER TO postgres; + +-- +-- Name: alts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.alts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.alts_id_seq OWNER TO postgres; + +-- +-- Name: alts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.alts_id_seq OWNED BY public.alts.id; + + +-- +-- Name: award_relationships; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.award_relationships ( + id integer NOT NULL, + user_id integer, + submission_id integer, + comment_id integer, + kind character varying(20) +); + + +ALTER TABLE public.award_relationships OWNER TO postgres; + +-- +-- Name: award_relationships_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.award_relationships_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.award_relationships_id_seq OWNER TO postgres; + +-- +-- Name: award_relationships_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.award_relationships_id_seq OWNED BY public.award_relationships.id; + + +-- +-- Name: badge_defs; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.badge_defs ( + id integer NOT NULL, + name character varying(64), + description character varying(256), + icon character varying(64), + kind integer, + rank integer, + qualification_expr character varying(128) +); + + +ALTER TABLE public.badge_defs OWNER TO postgres; + +-- +-- Name: badge_list_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.badge_list_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.badge_list_id_seq OWNER TO postgres; + +-- +-- Name: badge_list_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.badge_list_id_seq OWNED BY public.badge_defs.id; + + +-- +-- Name: badges; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.badges ( + id integer NOT NULL, + badge_id integer, + user_id integer, + description character varying(256), + url character varying(256) +); + + +ALTER TABLE public.badges OWNER TO postgres; + +-- +-- Name: badges_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.badges_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.badges_id_seq OWNER TO postgres; + +-- +-- Name: badges_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.badges_id_seq OWNED BY public.badges.id; + + +-- +-- Name: badlinks; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.badlinks ( + id integer NOT NULL, + reason integer, + link character varying(512), + autoban boolean +); + + +ALTER TABLE public.badlinks OWNER TO postgres; + +-- +-- Name: badlinks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.badlinks_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.badlinks_id_seq OWNER TO postgres; + +-- +-- Name: badlinks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.badlinks_id_seq OWNED BY public.badlinks.id; + + +-- +-- Name: badpics; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.badpics ( + id integer NOT NULL, + description character varying(255), + phash character varying(64), + ban_reason character varying(64), + ban_time integer DEFAULT 0 NOT NULL +); + + +ALTER TABLE public.badpics OWNER TO postgres; + +-- +-- Name: badpics_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.badpics_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.badpics_id_seq OWNER TO postgres; + +-- +-- Name: badpics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.badpics_id_seq OWNED BY public.badpics.id; + + +-- +-- Name: banneddomains; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.banneddomains ( + id integer NOT NULL, + domain character varying(100), + can_submit boolean, + can_comment boolean, + reason integer, + show_thumbnail boolean, + embed_function character varying(64), + embed_template character varying(32) DEFAULT NULL::character varying, + sandbox_embed boolean DEFAULT false +); + + +ALTER TABLE public.banneddomains OWNER TO postgres; + +-- +-- Name: client_auths; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.client_auths ( + id integer NOT NULL, + user_id integer, + oauth_client integer, + scope_guildmaster boolean, + access_token character(128) +); + + +ALTER TABLE public.client_auths OWNER TO postgres; + +-- +-- Name: client_auths_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.client_auths_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.client_auths_id_seq OWNER TO postgres; + +-- +-- Name: client_auths_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.client_auths_id_seq OWNED BY public.client_auths.id; + + +-- +-- Name: commentflags; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.commentflags ( + id integer NOT NULL, + user_id integer, + comment_id integer, + reason text +); + + +ALTER TABLE public.commentflags OWNER TO postgres; + +-- +-- Name: commentflags_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.commentflags_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.commentflags_id_seq OWNER TO postgres; + +-- +-- Name: commentflags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.commentflags_id_seq OWNED BY public.commentflags.id; + + +-- +-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.comments_id_seq @@ -380,15 +787,17 @@ CREATE SEQUENCE public.comments_id_seq CACHE 1; +ALTER TABLE public.comments_id_seq OWNER TO postgres; + -- --- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.comments_id_seq OWNED BY public.comments.id; -- --- Name: commentvotes; Type: TABLE; Schema: public; Owner: - +-- Name: commentvotes; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.commentvotes ( @@ -401,8 +810,10 @@ CREATE TABLE public.commentvotes ( ); +ALTER TABLE public.commentvotes OWNER TO postgres; + -- --- Name: commentvotes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: commentvotes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.commentvotes_id_seq @@ -414,15 +825,17 @@ CREATE SEQUENCE public.commentvotes_id_seq CACHE 1; +ALTER TABLE public.commentvotes_id_seq OWNER TO postgres; + -- --- Name: commentvotes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: commentvotes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.commentvotes_id_seq OWNED BY public.commentvotes.id; -- --- Name: domains_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: domains_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.domains_id_seq @@ -434,15 +847,17 @@ CREATE SEQUENCE public.domains_id_seq CACHE 1; +ALTER TABLE public.domains_id_seq OWNER TO postgres; + -- --- Name: domains_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: domains_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.domains_id_seq OWNED BY public.banneddomains.id; -- --- Name: flags; Type: TABLE; Schema: public; Owner: - +-- Name: flags; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.flags ( @@ -453,8 +868,10 @@ CREATE TABLE public.flags ( ); +ALTER TABLE public.flags OWNER TO postgres; + -- --- Name: flags_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: flags_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.flags_id_seq @@ -466,15 +883,17 @@ CREATE SEQUENCE public.flags_id_seq CACHE 1; +ALTER TABLE public.flags_id_seq OWNER TO postgres; + -- --- Name: flags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: flags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.flags_id_seq OWNED BY public.flags.id; -- --- Name: follows; Type: TABLE; Schema: public; Owner: - +-- Name: follows; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.follows ( @@ -484,8 +903,10 @@ CREATE TABLE public.follows ( ); +ALTER TABLE public.follows OWNER TO postgres; + -- --- Name: follows_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: follows_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.follows_id_seq @@ -497,15 +918,17 @@ CREATE SEQUENCE public.follows_id_seq CACHE 1; +ALTER TABLE public.follows_id_seq OWNER TO postgres; + -- --- Name: follows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: follows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.follows_id_seq OWNED BY public.follows.id; -- --- Name: images; Type: TABLE; Schema: public; Owner: - +-- Name: images; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.images ( @@ -517,8 +940,10 @@ CREATE TABLE public.images ( ); +ALTER TABLE public.images OWNER TO postgres; + -- --- Name: images_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: images_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.images_id_seq @@ -530,15 +955,17 @@ CREATE SEQUENCE public.images_id_seq CACHE 1; +ALTER TABLE public.images_id_seq OWNER TO postgres; + -- --- Name: images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.images_id_seq OWNED BY public.images.id; -- --- Name: modactions; Type: TABLE; Schema: public; Owner: - +-- Name: modactions; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.modactions ( @@ -549,12 +976,14 @@ CREATE TABLE public.modactions ( target_comment_id integer, created_utc integer DEFAULT 0, kind character varying(32) DEFAULT NULL::character varying, - _note text DEFAULT NULL::character varying + _note character varying(256) DEFAULT NULL::character varying ); +ALTER TABLE public.modactions OWNER TO postgres; + -- --- Name: modactions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: modactions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.modactions_id_seq @@ -566,15 +995,17 @@ CREATE SEQUENCE public.modactions_id_seq CACHE 1; +ALTER TABLE public.modactions_id_seq OWNER TO postgres; + -- --- Name: modactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: modactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.modactions_id_seq OWNED BY public.modactions.id; -- --- Name: notifications; Type: TABLE; Schema: public; Owner: - +-- Name: notifications; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.notifications ( @@ -585,12 +1016,15 @@ CREATE TABLE public.notifications ( followsender integer, unfollowsender integer, blocksender integer, + removefollowsender integer, unblocksender integer ); +ALTER TABLE public.notifications OWNER TO postgres; + -- --- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.notifications_id_seq @@ -602,15 +1036,17 @@ CREATE SEQUENCE public.notifications_id_seq CACHE 1; +ALTER TABLE public.notifications_id_seq OWNER TO postgres; + -- --- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id; -- --- Name: oauth_apps; Type: TABLE; Schema: public; Owner: - +-- Name: oauth_apps; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.oauth_apps ( @@ -623,8 +1059,10 @@ CREATE TABLE public.oauth_apps ( ); +ALTER TABLE public.oauth_apps OWNER TO postgres; + -- --- Name: oauth_apps_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: oauth_apps_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.oauth_apps_id_seq @@ -636,15 +1074,17 @@ CREATE SEQUENCE public.oauth_apps_id_seq CACHE 1; +ALTER TABLE public.oauth_apps_id_seq OWNER TO postgres; + -- --- Name: oauth_apps_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: oauth_apps_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.oauth_apps_id_seq OWNED BY public.oauth_apps.id; -- --- Name: save_relationship; Type: TABLE; Schema: public; Owner: - +-- Name: save_relationship; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.save_relationship ( @@ -655,8 +1095,10 @@ CREATE TABLE public.save_relationship ( ); +ALTER TABLE public.save_relationship OWNER TO postgres; + -- --- Name: save_relationship_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: save_relationship_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.save_relationship_id_seq @@ -668,55 +1110,17 @@ CREATE SEQUENCE public.save_relationship_id_seq CACHE 1; +ALTER TABLE public.save_relationship_id_seq OWNER TO postgres; + -- --- Name: save_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: save_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.save_relationship_id_seq OWNED BY public.save_relationship.id; -- --- Name: submissions; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.submissions ( - id integer NOT NULL, - author_id integer, - created_utc integer NOT NULL, - is_banned boolean, - over_18 boolean, - distinguish_level integer, - created_str character varying(255), - deleted_utc integer NOT NULL, - domain_ref integer, - is_approved integer NOT NULL, - edited_utc integer, - is_pinned boolean, - upvotes integer, - downvotes integer, - app_id integer, - thumburl text, - private boolean, - views integer, - is_bot boolean, - bannedfor boolean, - comment_count integer DEFAULT 0, - processing boolean DEFAULT false, - removed_by integer, - club boolean, - stickied text, - title character varying(500), - url character varying(2083), - body character varying(10000), - body_html character varying(20000), - embed_url character varying(10000), - ban_reason character varying(128), - title_html text -); - - --- --- Name: submissions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: submissions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.submissions_id_seq @@ -728,15 +1132,17 @@ CREATE SEQUENCE public.submissions_id_seq CACHE 1; +ALTER TABLE public.submissions_id_seq OWNER TO postgres; + -- --- Name: submissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: submissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.submissions_id_seq OWNED BY public.submissions.id; -- --- Name: subscriptions; Type: TABLE; Schema: public; Owner: - +-- Name: subscriptions; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.subscriptions ( @@ -747,8 +1153,10 @@ CREATE TABLE public.subscriptions ( ); +ALTER TABLE public.subscriptions OWNER TO postgres; + -- --- Name: subscriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: subscriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.subscriptions_id_seq @@ -760,15 +1168,17 @@ CREATE SEQUENCE public.subscriptions_id_seq CACHE 1; +ALTER TABLE public.subscriptions_id_seq OWNER TO postgres; + -- --- Name: subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.subscriptions_id_seq OWNED BY public.subscriptions.id; -- --- Name: userblocks; Type: TABLE; Schema: public; Owner: - +-- Name: userblocks; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.userblocks ( @@ -778,8 +1188,10 @@ CREATE TABLE public.userblocks ( ); +ALTER TABLE public.userblocks OWNER TO postgres; + -- --- Name: userblocks_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: userblocks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.userblocks_id_seq @@ -791,15 +1203,17 @@ CREATE SEQUENCE public.userblocks_id_seq CACHE 1; +ALTER TABLE public.userblocks_id_seq OWNER TO postgres; + -- --- Name: userblocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: userblocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.userblocks_id_seq OWNED BY public.userblocks.id; -- --- Name: users; Type: TABLE; Schema: public; Owner: - +-- Name: users; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.users ( @@ -811,8 +1225,8 @@ CREATE TABLE public.users ( admin_level integer, over_18 boolean, is_activated boolean, - bio character varying(1500), - bio_html character varying(10000), + bio character varying(300), + bio_html character varying(1000), referred_by integer, is_banned integer, ban_reason character varying(128), @@ -853,30 +1267,37 @@ CREATE TABLE public.users ( agendaposter boolean, agendaposter_expires_utc integer DEFAULT 0, resized boolean, + banawards integer, + animatedname boolean, suicide_utc integer, + highres text, post_count integer, comment_count integer, - highres text, rent_utc integer, - patron integer, + zzz boolean, controversial boolean, background text, - verified text, - fail_utc integer, + verified character varying(20), + patron integer, + quadrant text, steal_utc integer, + fail_utc integer, fail2_utc integer, cardview boolean, + basedcount integer, received_award_count integer, highlightcomments boolean, - club_banned boolean DEFAULT false, + club_banned boolean, nitter boolean, truecoins integer, club_allowed boolean DEFAULT false ); +ALTER TABLE public.users OWNER TO postgres; + -- --- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.users_id_seq @@ -888,15 +1309,17 @@ CREATE SEQUENCE public.users_id_seq CACHE 1; +ALTER TABLE public.users_id_seq OWNER TO postgres; + -- --- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; -- --- Name: viewers; Type: TABLE; Schema: public; Owner: - +-- Name: viewers; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.viewers ( @@ -907,8 +1330,10 @@ CREATE TABLE public.viewers ( ); +ALTER TABLE public.viewers OWNER TO postgres; + -- --- Name: viewers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: viewers_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.viewers_id_seq @@ -920,15 +1345,17 @@ CREATE SEQUENCE public.viewers_id_seq CACHE 1; +ALTER TABLE public.viewers_id_seq OWNER TO postgres; + -- --- Name: viewers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: viewers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.viewers_id_seq OWNED BY public.viewers.id; -- --- Name: votes; Type: TABLE; Schema: public; Owner: - +-- Name: votes; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.votes ( @@ -941,8 +1368,10 @@ CREATE TABLE public.votes ( ); +ALTER TABLE public.votes OWNER TO postgres; + -- --- Name: votes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: votes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.votes_id_seq @@ -954,183 +1383,185 @@ CREATE SEQUENCE public.votes_id_seq CACHE 1; +ALTER TABLE public.votes_id_seq OWNER TO postgres; + -- --- Name: votes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: votes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.votes_id_seq OWNED BY public.votes.id; -- --- Name: alts id; Type: DEFAULT; Schema: public; Owner: - +-- Name: alts id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.alts ALTER COLUMN id SET DEFAULT nextval('public.alts_id_seq'::regclass); -- --- Name: award_relationships id; Type: DEFAULT; Schema: public; Owner: - +-- Name: award_relationships id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.award_relationships ALTER COLUMN id SET DEFAULT nextval('public.award_relationships_id_seq'::regclass); -- --- Name: badge_defs id; Type: DEFAULT; Schema: public; Owner: - +-- Name: badge_defs id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badge_defs ALTER COLUMN id SET DEFAULT nextval('public.badge_list_id_seq'::regclass); -- --- Name: badges id; Type: DEFAULT; Schema: public; Owner: - +-- Name: badges id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badges ALTER COLUMN id SET DEFAULT nextval('public.badges_id_seq'::regclass); -- --- Name: badlinks id; Type: DEFAULT; Schema: public; Owner: - +-- Name: badlinks id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badlinks ALTER COLUMN id SET DEFAULT nextval('public.badlinks_id_seq'::regclass); -- --- Name: badpics id; Type: DEFAULT; Schema: public; Owner: - +-- Name: badpics id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badpics ALTER COLUMN id SET DEFAULT nextval('public.badpics_id_seq'::regclass); -- --- Name: banneddomains id; Type: DEFAULT; Schema: public; Owner: - +-- Name: banneddomains id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.banneddomains ALTER COLUMN id SET DEFAULT nextval('public.domains_id_seq'::regclass); -- --- Name: client_auths id; Type: DEFAULT; Schema: public; Owner: - +-- Name: client_auths id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.client_auths ALTER COLUMN id SET DEFAULT nextval('public.client_auths_id_seq'::regclass); -- --- Name: commentflags id; Type: DEFAULT; Schema: public; Owner: - +-- Name: commentflags id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.commentflags ALTER COLUMN id SET DEFAULT nextval('public.commentflags_id_seq'::regclass); -- --- Name: comments id; Type: DEFAULT; Schema: public; Owner: - +-- Name: comments id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.comments ALTER COLUMN id SET DEFAULT nextval('public.comments_id_seq'::regclass); -- --- Name: commentvotes id; Type: DEFAULT; Schema: public; Owner: - +-- Name: commentvotes id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.commentvotes ALTER COLUMN id SET DEFAULT nextval('public.commentvotes_id_seq'::regclass); -- --- Name: flags id; Type: DEFAULT; Schema: public; Owner: - +-- Name: flags id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.flags ALTER COLUMN id SET DEFAULT nextval('public.flags_id_seq'::regclass); -- --- Name: follows id; Type: DEFAULT; Schema: public; Owner: - +-- Name: follows id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.follows ALTER COLUMN id SET DEFAULT nextval('public.follows_id_seq'::regclass); -- --- Name: images id; Type: DEFAULT; Schema: public; Owner: - +-- Name: images id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.images ALTER COLUMN id SET DEFAULT nextval('public.images_id_seq'::regclass); -- --- Name: modactions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: modactions id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.modactions ALTER COLUMN id SET DEFAULT nextval('public.modactions_id_seq'::regclass); -- --- Name: notifications id; Type: DEFAULT; Schema: public; Owner: - +-- Name: notifications id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('public.notifications_id_seq'::regclass); -- --- Name: oauth_apps id; Type: DEFAULT; Schema: public; Owner: - +-- Name: oauth_apps id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.oauth_apps ALTER COLUMN id SET DEFAULT nextval('public.oauth_apps_id_seq'::regclass); -- --- Name: save_relationship id; Type: DEFAULT; Schema: public; Owner: - +-- Name: save_relationship id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.save_relationship ALTER COLUMN id SET DEFAULT nextval('public.save_relationship_id_seq'::regclass); -- --- Name: submissions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: submissions id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.submissions ALTER COLUMN id SET DEFAULT nextval('public.submissions_id_seq'::regclass); -- --- Name: subscriptions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: subscriptions id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.subscriptions ALTER COLUMN id SET DEFAULT nextval('public.subscriptions_id_seq'::regclass); -- --- Name: userblocks id; Type: DEFAULT; Schema: public; Owner: - +-- Name: userblocks id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.userblocks ALTER COLUMN id SET DEFAULT nextval('public.userblocks_id_seq'::regclass); -- --- Name: users id; Type: DEFAULT; Schema: public; Owner: - +-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); -- --- Name: viewers id; Type: DEFAULT; Schema: public; Owner: - +-- Name: viewers id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.viewers ALTER COLUMN id SET DEFAULT nextval('public.viewers_id_seq'::regclass); -- --- Name: votes id; Type: DEFAULT; Schema: public; Owner: - +-- Name: votes id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.votes ALTER COLUMN id SET DEFAULT nextval('public.votes_id_seq'::regclass); -- --- Name: alts alts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: alts alts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.alts @@ -1138,7 +1569,7 @@ ALTER TABLE ONLY public.alts -- --- Name: award_relationships award_constraint; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: award_relationships award_constraint; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.award_relationships @@ -1146,7 +1577,7 @@ ALTER TABLE ONLY public.award_relationships -- --- Name: award_relationships award_relationships_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: award_relationships award_relationships_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.award_relationships @@ -1154,7 +1585,7 @@ ALTER TABLE ONLY public.award_relationships -- --- Name: badge_defs badge_defs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: badge_defs badge_defs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badge_defs @@ -1162,7 +1593,7 @@ ALTER TABLE ONLY public.badge_defs -- --- Name: badge_defs badge_list_icon_key; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: badge_defs badge_list_icon_key; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badge_defs @@ -1170,7 +1601,7 @@ ALTER TABLE ONLY public.badge_defs -- --- Name: badges badges_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: badges badges_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badges @@ -1178,7 +1609,7 @@ ALTER TABLE ONLY public.badges -- --- Name: badlinks badlinks_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: badlinks badlinks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badlinks @@ -1186,7 +1617,7 @@ ALTER TABLE ONLY public.badlinks -- --- Name: badpics badpics_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: badpics badpics_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badpics @@ -1194,7 +1625,7 @@ ALTER TABLE ONLY public.badpics -- --- Name: client_auths client_auths_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: client_auths client_auths_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.client_auths @@ -1202,7 +1633,7 @@ ALTER TABLE ONLY public.client_auths -- --- Name: commentflags commentflags_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: commentflags commentflags_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.commentflags @@ -1210,7 +1641,7 @@ ALTER TABLE ONLY public.commentflags -- --- Name: comments comments_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: comments comments_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.comments @@ -1218,7 +1649,7 @@ ALTER TABLE ONLY public.comments -- --- Name: commentvotes commentvotes_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: commentvotes commentvotes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.commentvotes @@ -1226,7 +1657,7 @@ ALTER TABLE ONLY public.commentvotes -- --- Name: banneddomains domains_domain_key; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: banneddomains domains_domain_key; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.banneddomains @@ -1234,7 +1665,7 @@ ALTER TABLE ONLY public.banneddomains -- --- Name: banneddomains domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: banneddomains domains_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.banneddomains @@ -1242,7 +1673,7 @@ ALTER TABLE ONLY public.banneddomains -- --- Name: flags flags_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: flags flags_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.flags @@ -1250,7 +1681,7 @@ ALTER TABLE ONLY public.flags -- --- Name: follows follow_membership_unique; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: follows follow_membership_unique; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.follows @@ -1258,7 +1689,7 @@ ALTER TABLE ONLY public.follows -- --- Name: follows follows_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: follows follows_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.follows @@ -1266,7 +1697,15 @@ ALTER TABLE ONLY public.follows -- --- Name: images images_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: subscriptions guild_membership_unique; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.subscriptions + ADD CONSTRAINT guild_membership_unique UNIQUE (user_id, board_id); + + +-- +-- Name: images images_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.images @@ -1274,7 +1713,7 @@ ALTER TABLE ONLY public.images -- --- Name: modactions modactions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: modactions modactions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.modactions @@ -1282,7 +1721,7 @@ ALTER TABLE ONLY public.modactions -- --- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.notifications @@ -1290,7 +1729,7 @@ ALTER TABLE ONLY public.notifications -- --- Name: oauth_apps oauth_apps_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: oauth_apps oauth_apps_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.oauth_apps @@ -1298,7 +1737,7 @@ ALTER TABLE ONLY public.oauth_apps -- --- Name: users one_discord_account; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: users one_discord_account; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.users @@ -1306,7 +1745,7 @@ ALTER TABLE ONLY public.users -- --- Name: notifications one_notif; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: notifications one_notif; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.notifications @@ -1314,7 +1753,7 @@ ALTER TABLE ONLY public.notifications -- --- Name: commentvotes onecvote; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: commentvotes onecvote; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.commentvotes @@ -1322,7 +1761,7 @@ ALTER TABLE ONLY public.commentvotes -- --- Name: votes onevote; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: votes onevote; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.votes @@ -1330,7 +1769,7 @@ ALTER TABLE ONLY public.votes -- --- Name: save_relationship save_constraint; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: save_relationship save_constraint; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.save_relationship @@ -1338,7 +1777,7 @@ ALTER TABLE ONLY public.save_relationship -- --- Name: save_relationship save_relationship_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: save_relationship save_relationship_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.save_relationship @@ -1346,7 +1785,7 @@ ALTER TABLE ONLY public.save_relationship -- --- Name: submissions submissions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: submissions submissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.submissions @@ -1354,7 +1793,7 @@ ALTER TABLE ONLY public.submissions -- --- Name: subscriptions subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: subscriptions subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.subscriptions @@ -1362,7 +1801,7 @@ ALTER TABLE ONLY public.subscriptions -- --- Name: client_auths unique_access; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: client_auths unique_access; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.client_auths @@ -1370,7 +1809,7 @@ ALTER TABLE ONLY public.client_auths -- --- Name: oauth_apps unique_id; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: oauth_apps unique_id; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.oauth_apps @@ -1378,7 +1817,7 @@ ALTER TABLE ONLY public.oauth_apps -- --- Name: badges user_badge_constraint; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: badges user_badge_constraint; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badges @@ -1386,7 +1825,7 @@ ALTER TABLE ONLY public.badges -- --- Name: userblocks userblocks_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: userblocks userblocks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.userblocks @@ -1394,7 +1833,7 @@ ALTER TABLE ONLY public.userblocks -- --- Name: alts userpair; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: alts userpair; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.alts @@ -1402,7 +1841,7 @@ ALTER TABLE ONLY public.alts -- --- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.users @@ -1410,7 +1849,7 @@ ALTER TABLE ONLY public.users -- --- Name: users users_original_username_key; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: users users_original_username_key; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.users @@ -1418,7 +1857,7 @@ ALTER TABLE ONLY public.users -- --- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.users @@ -1426,7 +1865,7 @@ ALTER TABLE ONLY public.users -- --- Name: users users_username_key; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: users users_username_key; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.users @@ -1434,7 +1873,7 @@ ALTER TABLE ONLY public.users -- --- Name: viewers viewers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: viewers viewers_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.viewers @@ -1442,7 +1881,7 @@ ALTER TABLE ONLY public.viewers -- --- Name: votes votes_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: votes votes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.votes @@ -1450,462 +1889,518 @@ ALTER TABLE ONLY public.votes -- --- Name: alts_user1_idx; Type: INDEX; Schema: public; Owner: - +-- Name: alts_user1_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX alts_user1_idx ON public.alts USING btree (user1); -- --- Name: alts_user2_idx; Type: INDEX; Schema: public; Owner: - +-- Name: alts_user2_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX alts_user2_idx ON public.alts USING btree (user2); -- --- Name: award_comment_idx; Type: INDEX; Schema: public; Owner: - +-- Name: award_comment_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX award_comment_idx ON public.award_relationships USING btree (comment_id); -- --- Name: award_post_idx; Type: INDEX; Schema: public; Owner: - +-- Name: award_post_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX award_post_idx ON public.award_relationships USING btree (submission_id); -- --- Name: award_user_idx; Type: INDEX; Schema: public; Owner: - +-- Name: award_user_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX award_user_idx ON public.award_relationships USING btree (user_id); -- --- Name: badgedef_qual_idx; Type: INDEX; Schema: public; Owner: - +-- Name: badgedef_qual_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX badgedef_qual_idx ON public.badge_defs USING btree (qualification_expr); -- --- Name: badges_badge_id_idx; Type: INDEX; Schema: public; Owner: - +-- Name: badges_badge_id_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX badges_badge_id_idx ON public.badges USING btree (badge_id); -- --- Name: badges_user_index; Type: INDEX; Schema: public; Owner: - +-- Name: badges_user_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX badges_user_index ON public.badges USING btree (user_id); -- --- Name: badlink_link_idx; Type: INDEX; Schema: public; Owner: - +-- Name: badlink_link_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX badlink_link_idx ON public.badlinks USING btree (link); -- --- Name: badpic_phash_idx; Type: INDEX; Schema: public; Owner: - +-- Name: badpic_phash_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX badpic_phash_idx ON public.badpics USING btree (phash); -- --- Name: badpic_phash_trgm_idx; Type: INDEX; Schema: public; Owner: - +-- Name: badpic_phash_trgm_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX badpic_phash_trgm_idx ON public.badpics USING gin (phash public.gin_trgm_ops); -- --- Name: badpics_phash_index; Type: INDEX; Schema: public; Owner: - +-- Name: badpics_phash_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX badpics_phash_index ON public.badpics USING gin (phash public.gin_trgm_ops); -- --- Name: block_target_idx; Type: INDEX; Schema: public; Owner: - +-- Name: block_target_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX block_target_idx ON public.userblocks USING btree (target_id); -- --- Name: block_user_idx; Type: INDEX; Schema: public; Owner: - +-- Name: block_user_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX block_user_idx ON public.userblocks USING btree (user_id); -- --- Name: cflag_user_idx; Type: INDEX; Schema: public; Owner: - +-- Name: cflag_user_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX cflag_user_idx ON public.commentflags USING btree (user_id); -- --- Name: comment_parent_index; Type: INDEX; Schema: public; Owner: - +-- Name: comment_parent_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX comment_parent_index ON public.comments USING btree (parent_comment_id); -- --- Name: comment_post_id_index; Type: INDEX; Schema: public; Owner: - +-- Name: comment_post_id_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX comment_post_id_index ON public.comments USING btree (parent_submission); -- --- Name: commentflag_comment_index; Type: INDEX; Schema: public; Owner: - +-- Name: commentflag_comment_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX commentflag_comment_index ON public.commentflags USING btree (comment_id); -- --- Name: comments_parent_id_idx; Type: INDEX; Schema: public; Owner: - +-- Name: comments_parent_id_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX comments_parent_id_idx ON public.comments USING btree (parent_comment_id); -- --- Name: comments_user_index; Type: INDEX; Schema: public; Owner: - +-- Name: comments_user_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX comments_user_index ON public.comments USING btree (author_id); -- --- Name: commentvotes_comments_id_index; Type: INDEX; Schema: public; Owner: - +-- Name: commentvotes_comments_id_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX commentvotes_comments_id_index ON public.commentvotes USING btree (comment_id); -- --- Name: commentvotes_comments_type_index; Type: INDEX; Schema: public; Owner: - +-- Name: commentvotes_comments_type_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX commentvotes_comments_type_index ON public.commentvotes USING btree (vote_type); -- --- Name: cvote_user_index; Type: INDEX; Schema: public; Owner: - +-- Name: cvote_user_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX cvote_user_index ON public.commentvotes USING btree (user_id); -- --- Name: discord_id_idx; Type: INDEX; Schema: public; Owner: - +-- Name: discord_id_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX discord_id_idx ON public.users USING btree (discord_id); -- --- Name: domain_ref_idx; Type: INDEX; Schema: public; Owner: - +-- Name: domain_ref_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX domain_ref_idx ON public.submissions USING btree (domain_ref); -- --- Name: domains_domain_trgm_idx; Type: INDEX; Schema: public; Owner: - +-- Name: domains_domain_trgm_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX domains_domain_trgm_idx ON public.banneddomains USING gin (domain public.gin_trgm_ops); -- --- Name: flag_user_idx; Type: INDEX; Schema: public; Owner: - +-- Name: flag_user_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX flag_user_idx ON public.flags USING btree (user_id); -- --- Name: flags_post_index; Type: INDEX; Schema: public; Owner: - +-- Name: flags_post_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX flags_post_index ON public.flags USING btree (post_id); -- --- Name: follow_target_id_index; Type: INDEX; Schema: public; Owner: - +-- Name: follow_target_id_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX follow_target_id_index ON public.follows USING btree (target_id); -- --- Name: follow_user_id_index; Type: INDEX; Schema: public; Owner: - +-- Name: follow_user_id_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX follow_user_id_index ON public.follows USING btree (user_id); -- --- Name: modaction_action_idx; Type: INDEX; Schema: public; Owner: - +-- Name: modaction_action_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX modaction_action_idx ON public.modactions USING btree (kind); -- --- Name: modaction_cid_idx; Type: INDEX; Schema: public; Owner: - +-- Name: modaction_cid_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX modaction_cid_idx ON public.modactions USING btree (target_comment_id); -- --- Name: modaction_id_idx; Type: INDEX; Schema: public; Owner: - +-- Name: modaction_id_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX modaction_id_idx ON public.modactions USING btree (id DESC); -- --- Name: modaction_pid_idx; Type: INDEX; Schema: public; Owner: - +-- Name: modaction_pid_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX modaction_pid_idx ON public.modactions USING btree (target_submission_id); -- --- Name: notification_read_idx; Type: INDEX; Schema: public; Owner: - +-- Name: notification_read_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX notification_read_idx ON public.notifications USING btree (read); -- --- Name: notifications_comment_idx; Type: INDEX; Schema: public; Owner: - +-- Name: notifications_comment_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX notifications_comment_idx ON public.notifications USING btree (comment_id); -- --- Name: notifications_user_index; Type: INDEX; Schema: public; Owner: - +-- Name: notifications_user_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX notifications_user_index ON public.notifications USING btree (user_id); -- --- Name: notifs_user_read_idx; Type: INDEX; Schema: public; Owner: - +-- Name: notifs_user_read_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX notifs_user_read_idx ON public.notifications USING btree (user_id, read); -- --- Name: post_18_index; Type: INDEX; Schema: public; Owner: - +-- Name: post_18_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX post_18_index ON public.submissions USING btree (over_18); -- --- Name: post_app_id_idx; Type: INDEX; Schema: public; Owner: - +-- Name: post_app_id_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX post_app_id_idx ON public.submissions USING btree (app_id); -- --- Name: post_author_index; Type: INDEX; Schema: public; Owner: - +-- Name: post_author_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX post_author_index ON public.submissions USING btree (author_id); -- --- Name: sub_user_index; Type: INDEX; Schema: public; Owner: - +-- Name: post_offensive_index; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX post_offensive_index ON public.submissions USING btree (is_offensive); + + +-- +-- Name: post_public_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX post_public_idx ON public.submissions USING btree (post_public); + + +-- +-- Name: sub_user_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX sub_user_index ON public.subscriptions USING btree (user_id); -- --- Name: subimssion_binary_group_idx; Type: INDEX; Schema: public; Owner: - +-- Name: subimssion_binary_group_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX subimssion_binary_group_idx ON public.submissions USING btree (is_banned, deleted_utc, over_18); -- --- Name: submission_domainref_index; Type: INDEX; Schema: public; Owner: - +-- Name: submission_best_only_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX submission_best_only_idx ON public.submissions USING btree (score_best DESC); + + +-- +-- Name: submission_disputed_sort_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX submission_disputed_sort_idx ON public.submissions USING btree (is_banned, deleted_utc, score_disputed DESC, over_18); + + +-- +-- Name: submission_domainref_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX submission_domainref_index ON public.submissions USING btree (domain_ref); -- --- Name: submission_isbanned_idx; Type: INDEX; Schema: public; Owner: - +-- Name: submission_hot_sort_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX submission_hot_sort_idx ON public.submissions USING btree (is_banned, deleted_utc, score_hot DESC, over_18); + + +-- +-- Name: submission_isbanned_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX submission_isbanned_idx ON public.submissions USING btree (is_banned); -- --- Name: submission_isdeleted_idx; Type: INDEX; Schema: public; Owner: - +-- Name: submission_isdeleted_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX submission_isdeleted_idx ON public.submissions USING btree (deleted_utc); -- --- Name: submission_new_sort_idx; Type: INDEX; Schema: public; Owner: - +-- Name: submission_new_sort_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX submission_new_sort_idx ON public.submissions USING btree (is_banned, deleted_utc, created_utc DESC, over_18); -- --- Name: submission_pinned_idx; Type: INDEX; Schema: public; Owner: - +-- Name: submission_pinned_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX submission_pinned_idx ON public.submissions USING btree (is_pinned); -- --- Name: submissions_author_index; Type: INDEX; Schema: public; Owner: - +-- Name: submission_purge_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX submission_purge_idx ON public.submissions USING btree (purged_utc); + + +-- +-- Name: submissions_author_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX submissions_author_index ON public.submissions USING btree (author_id); -- --- Name: submissions_created_utc_desc_idx; Type: INDEX; Schema: public; Owner: - +-- Name: submissions_created_utc_desc_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX submissions_created_utc_desc_idx ON public.submissions USING btree (created_utc DESC); -- --- Name: submissions_over18_index; Type: INDEX; Schema: public; Owner: - +-- Name: submissions_offensive_index; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX submissions_offensive_index ON public.submissions USING btree (is_offensive); + + +-- +-- Name: submissions_over18_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX submissions_over18_index ON public.submissions USING btree (over_18); -- --- Name: subscription_board_index; Type: INDEX; Schema: public; Owner: - +-- Name: submissions_score_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX submissions_score_idx ON public.submissions USING btree (score_top); + + +-- +-- Name: subscription_board_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX subscription_board_index ON public.subscriptions USING btree (board_id); -- --- Name: subscription_user_index; Type: INDEX; Schema: public; Owner: - +-- Name: subscription_user_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX subscription_user_index ON public.subscriptions USING btree (user_id); -- --- Name: user_banned_idx; Type: INDEX; Schema: public; Owner: - +-- Name: user_banned_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX user_banned_idx ON public.users USING btree (is_banned); -- --- Name: user_privacy_idx; Type: INDEX; Schema: public; Owner: - +-- Name: user_privacy_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX user_privacy_idx ON public.users USING btree (is_private); -- --- Name: user_private_idx; Type: INDEX; Schema: public; Owner: - +-- Name: user_private_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX user_private_idx ON public.users USING btree (is_private); -- --- Name: userblocks_both_idx; Type: INDEX; Schema: public; Owner: - +-- Name: userblocks_both_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX userblocks_both_idx ON public.userblocks USING btree (user_id, target_id); -- --- Name: users_created_utc_index; Type: INDEX; Schema: public; Owner: - +-- Name: users_created_utc_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX users_created_utc_index ON public.users USING btree (created_utc); -- --- Name: users_original_username_trgm_idx; Type: INDEX; Schema: public; Owner: - +-- Name: users_original_username_trgm_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX users_original_username_trgm_idx ON public.users USING gin (original_username public.gin_trgm_ops); -- --- Name: users_subs_idx; Type: INDEX; Schema: public; Owner: - +-- Name: users_subs_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX users_subs_idx ON public.users USING btree (stored_subscriber_count); -- --- Name: users_unbanutc_idx; Type: INDEX; Schema: public; Owner: - +-- Name: users_unbanutc_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX users_unbanutc_idx ON public.users USING btree (unban_utc DESC); -- --- Name: users_username_trgm_idx; Type: INDEX; Schema: public; Owner: - +-- Name: users_username_trgm_idx; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX users_username_trgm_idx ON public.users USING gin (username public.gin_trgm_ops); -- --- Name: vote_user_index; Type: INDEX; Schema: public; Owner: - +-- Name: vote_user_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX vote_user_index ON public.votes USING btree (user_id); -- --- Name: votes_submission_id_index; Type: INDEX; Schema: public; Owner: - +-- Name: votes_submission_id_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX votes_submission_id_index ON public.votes USING btree (submission_id); -- --- Name: votes_type_index; Type: INDEX; Schema: public; Owner: - +-- Name: votes_type_index; Type: INDEX; Schema: public; Owner: postgres -- CREATE INDEX votes_type_index ON public.votes USING btree (vote_type); -- --- Name: badges badges_badge_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: badges badges_badge_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.badges @@ -1913,7 +2408,7 @@ ALTER TABLE ONLY public.badges -- --- Name: commentflags commentflags_comment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: commentflags commentflags_comment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.commentflags @@ -1921,7 +2416,7 @@ ALTER TABLE ONLY public.commentflags -- --- Name: flags flags_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: flags flags_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.flags @@ -1929,8 +2424,21 @@ ALTER TABLE ONLY public.flags -- --- Name: notifications notifications_comment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: notifications notifications_comment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.notifications ADD CONSTRAINT notifications_comment_id_fkey FOREIGN KEY (comment_id) REFERENCES public.comments(id); + + +-- +-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres +-- + +GRANT ALL ON SCHEMA public TO PUBLIC; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/seed-db.sql b/seed-db.sql index 4fc5a1947..2f5223125 100644 --- a/seed-db.sql +++ b/seed-db.sql @@ -1,28 +1,28 @@ -INSERT INTO public.badge_defs VALUES (12, 'Gold Recruiter', 'Recruited 100 friends to join Drama', 'recruit-100.webp', 1, 'v.referral_count>=100 and v.referral_count <=999'); -INSERT INTO public.badge_defs VALUES (11, 'Silver Recruiter', 'Recruited 10 friends to join Drama', 'recruit-10.webp', 1, 'v.referral_count>=10 and v.referral_count <= 99'); -INSERT INTO public.badge_defs VALUES (10, 'Bronze Recruiter', 'Recruited 1 friend to join Drama', 'recruit-1.webp', 1, 'v.referral_count>=1 and v.referral_count<9'); -INSERT INTO public.badge_defs VALUES (58, 'Diamond Recruiter', 'Recruited 1000 friends to join Drama', 'recruit-1000.webp', 1, 'v.referral_count >= 1000'); -INSERT INTO public.badge_defs VALUES (25, 'Footpig', 'Contributed at least $100/month', 'patron-5.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (61, 'Lab Rat', 'Helped test features in development', 'labrat.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (63, 'Balls', 'I wrote carp on my balls as a sign of submission', 'carpballs.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (4, 'White Hat', 'Responsibly reported a security issue', 'whitehat.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (2, 'Verified Email', 'Verified Email', 'mail.webp', 1, NULL); -INSERT INTO public.badge_defs VALUES (6, 'Beta User', 'Joined during open beta', 'beta.webp', 4, NULL); -INSERT INTO public.badge_defs VALUES (15, 'Idea Maker', 'Had a good idea for Drama which was implemented by the developers', 'idea.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (3, 'Code Contributor', 'Contributed to Drama source code', 'git.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (1, 'Alpha User', 'Joined during open alpha', 'alpha.webp', 4, NULL); -INSERT INTO public.badge_defs VALUES (18, 'Artisan', 'Contributed to Drama artwork', 'art.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (27, 'Lolcow', 'Beautiful and valid milk provider', 'lolcow.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (21, 'Paypig', 'Contributed at least $5/month', 'patron-1.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (22, 'Renthog', 'Contributed at least $10/month', 'patron-2.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (23, 'Landchad', 'Contributed at least $20/month', 'patron-3.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (24, 'Terminally online turboautist', 'Contributed at least $50/month', 'patron-4.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (28, 'Rich Bich', 'Contributed $500', 'patron-8.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (7, 'Bug Finder', 'Found a bug', 'sitebreaker.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (60, 'Unironically Retarded', 'Demonstrated a wholesale inability to read the room', 'retarded.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (26, 'Agendaposter', 'Forced to use the agendaposter theme', 'agendaposter.webp', 1, NULL); -INSERT INTO public.badge_defs VALUES (17, 'Marsey Artisan', 'Contributed a Marsey emoji ✨', 'marseybadge-1.webp', 3, NULL); -INSERT INTO public.badge_defs VALUES (16, 'Marsey Master', 'Contributed 10 (or more!!!!) Marsey emojis ✨', 'marseybadge-2.webp', 3, NULL); +INSERT INTO public.badge_defs VALUES (12, 'Gold Recruiter', 'Recruited 100 friends to join Drama', 'recruit-100.webp', 1, 1, 'v.referral_count>=100 and v.referral_count <=999'); +INSERT INTO public.badge_defs VALUES (11, 'Silver Recruiter', 'Recruited 10 friends to join Drama', 'recruit-10.webp', 1, 1, 'v.referral_count>=10 and v.referral_count <= 99'); +INSERT INTO public.badge_defs VALUES (10, 'Bronze Recruiter', 'Recruited 1 friend to join Drama', 'recruit-1.webp', 1, 1, 'v.referral_count>=1 and v.referral_count<9'); +INSERT INTO public.badge_defs VALUES (58, 'Diamond Recruiter', 'Recruited 1000 friends to join Drama', 'recruit-1000.webp', 1, 1, 'v.referral_count >= 1000'); +INSERT INTO public.badge_defs VALUES (25, 'Footpig', 'Contributed at least $100/month', 'patron-5.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (61, 'Lab Rat', 'Helped test features in development', 'labrat.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (63, 'Balls', 'I wrote carp on my balls as a sign of submission', 'carpballs.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (4, 'White Hat', 'Responsibly reported a security issue', 'whitehat.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (2, 'Verified Email', 'Verified Email', 'mail.webp', 1, 1, NULL); +INSERT INTO public.badge_defs VALUES (6, 'Beta User', 'Joined during open beta', 'beta.webp', 4, 1, NULL); +INSERT INTO public.badge_defs VALUES (15, 'Idea Maker', 'Had a good idea for Drama which was implemented by the developers', 'idea.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (3, 'Code Contributor', 'Contributed to Drama source code', 'git.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (1, 'Alpha User', 'Joined during open alpha', 'alpha.webp', 4, 1, NULL); +INSERT INTO public.badge_defs VALUES (18, 'Artisan', 'Contributed to Drama artwork', 'art.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (27, 'Lolcow', 'Beautiful and valid milk provider', 'lolcow.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (21, 'Paypig', 'Contributed at least $5/month', 'patron-1.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (22, 'Renthog', 'Contributed at least $10/month', 'patron-2.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (23, 'Landchad', 'Contributed at least $20/month', 'patron-3.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (24, 'Terminally online turboautist', 'Contributed at least $50/month', 'patron-4.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (28, 'Rich Bich', 'Contributed $500', 'patron-8.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (7, 'Bug Finder', 'Found a bug', 'sitebreaker.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (60, 'Unironically Retarded', 'Demonstrated a wholesale inability to read the room', 'retarded.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (26, 'Agendaposter', 'Forced to use the agendaposter theme', 'agendaposter.webp', 1, 1, NULL); +INSERT INTO public.badge_defs VALUES (17, 'Marsey Artisan', 'Contributed a Marsey emoji ✨', 'marseybadge-1.webp', 3, 1, NULL); +INSERT INTO public.badge_defs VALUES (16, 'Marsey Master', 'Contributed 10 (or more!!!!) Marsey emojis ✨', 'marseybadge-2.webp', 3, 1, NULL); insert into public.award_relationships(id,user_id,kind) values(1,1,'shit');