diff --git a/docs/specs/schema.sql b/docs/specs/schema.sql new file mode 100644 index 0000000..c350384 --- /dev/null +++ b/docs/specs/schema.sql @@ -0,0 +1,2399 @@ +-- +-- PostgreSQL database dump +-- + +\restrict qEGJezae9dSRMFptmcVl4X7XfSkrcehS1gGgER2LLUmXbVTLOxqrxziRuYQs4bz + +-- Dumped from database version 16.10 +-- Dumped by pg_dump version 16.10 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- Name: achievement; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.achievement ( + id bigint NOT NULL, + name text NOT NULL, + description text NOT NULL, + icon text NOT NULL, + rarity text NOT NULL, + hidden boolean DEFAULT false NOT NULL, + metric text NOT NULL, + operator text NOT NULL, + threshold integer NOT NULL, + visible boolean DEFAULT true NOT NULL, + unlock_count integer DEFAULT 0 NOT NULL, + "order" integer DEFAULT 0 NOT NULL, + create_time timestamp with time zone NOT NULL +); + + +-- +-- Name: achievement_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.achievement ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.achievement_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: acm_contest_rank; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.acm_contest_rank ( + id integer NOT NULL, + submission_number integer DEFAULT 0 NOT NULL, + accepted_number integer DEFAULT 0 NOT NULL, + total_time integer DEFAULT 0 NOT NULL, + submission_info jsonb DEFAULT '{}'::jsonb NOT NULL, + contest_id integer NOT NULL, + user_id integer NOT NULL +); + + +-- +-- Name: acm_contest_rank_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.acm_contest_rank_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: acm_contest_rank_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.acm_contest_rank_id_seq OWNED BY public.acm_contest_rank.id; + + +-- +-- Name: ai_analysis; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ai_analysis ( + id bigint NOT NULL, + provider text NOT NULL, + data jsonb NOT NULL, + system_prompt text NOT NULL, + user_prompt text NOT NULL, + analysis text NOT NULL, + create_time timestamp with time zone NOT NULL, + user_id integer NOT NULL, + model text NOT NULL, + is_pinned boolean NOT NULL +); + + +-- +-- Name: ai_analysis_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.ai_analysis ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.ai_analysis_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: announcement; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.announcement ( + id integer NOT NULL, + title text NOT NULL, + content text NOT NULL, + create_time timestamp with time zone NOT NULL, + last_update_time timestamp with time zone NOT NULL, + visible boolean NOT NULL, + created_by_id integer NOT NULL, + tag text NOT NULL, + top boolean NOT NULL +); + + +-- +-- Name: announcement_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.announcement_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: announcement_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.announcement_id_seq OWNED BY public.announcement.id; + + +-- +-- Name: auth_group; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.auth_group ( + id integer NOT NULL, + name character varying(150) NOT NULL +); + + +-- +-- Name: auth_group_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.auth_group_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: auth_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.auth_group_id_seq OWNED BY public.auth_group.id; + + +-- +-- Name: auth_group_permissions; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.auth_group_permissions ( + id integer NOT NULL, + group_id integer NOT NULL, + permission_id integer NOT NULL +); + + +-- +-- Name: auth_group_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.auth_group_permissions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: auth_group_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.auth_group_permissions_id_seq OWNED BY public.auth_group_permissions.id; + + +-- +-- Name: auth_permission; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.auth_permission ( + id integer NOT NULL, + name character varying(255) NOT NULL, + content_type_id integer NOT NULL, + codename character varying(100) NOT NULL +); + + +-- +-- Name: auth_permission_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.auth_permission_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: auth_permission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.auth_permission_id_seq OWNED BY public.auth_permission.id; + + +-- +-- Name: contest; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.contest ( + id integer NOT NULL, + title text NOT NULL, + description text NOT NULL, + password text, + start_time timestamp with time zone NOT NULL, + end_time timestamp with time zone NOT NULL, + create_time timestamp with time zone NOT NULL, + last_update_time timestamp with time zone NOT NULL, + visible boolean NOT NULL, + created_by_id integer NOT NULL, + allowed_ip_ranges jsonb NOT NULL, + tag text NOT NULL +); + + +-- +-- Name: contest_announcement; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.contest_announcement ( + id integer NOT NULL, + title text NOT NULL, + content text NOT NULL, + create_time timestamp with time zone NOT NULL, + contest_id integer NOT NULL, + created_by_id integer NOT NULL, + visible boolean NOT NULL +); + + +-- +-- Name: contest_announcement_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.contest_announcement_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contest_announcement_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.contest_announcement_id_seq OWNED BY public.contest_announcement.id; + + +-- +-- Name: contest_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.contest_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contest_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.contest_id_seq OWNED BY public.contest.id; + + +-- +-- Name: django_content_type; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.django_content_type ( + id integer NOT NULL, + app_label character varying(100) NOT NULL, + model character varying(100) NOT NULL +); + + +-- +-- Name: django_content_type_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.django_content_type_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: django_content_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.django_content_type_id_seq OWNED BY public.django_content_type.id; + + +-- +-- Name: django_dramatiq_task; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.django_dramatiq_task ( + id uuid NOT NULL, + status character varying(8) NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + message_data bytea NOT NULL, + actor_name character varying(300), + queue_name character varying(100) +); + + +-- +-- Name: django_migrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.django_migrations ( + id integer NOT NULL, + app character varying(255) NOT NULL, + name character varying(255) NOT NULL, + applied timestamp with time zone NOT NULL +); + + +-- +-- Name: django_migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.django_migrations ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.django_migrations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: django_session; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.django_session ( + session_key character varying(40) NOT NULL, + session_data text NOT NULL, + expire_date timestamp with time zone NOT NULL +); + + +-- +-- Name: exercise; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.exercise ( + id integer NOT NULL, + type character varying(16) NOT NULL, + data jsonb NOT NULL, + "order" integer NOT NULL, + created_at timestamp with time zone NOT NULL, + tutorial_id integer NOT NULL +); + + +-- +-- Name: exercise_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.exercise ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.exercise_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: flowchart_submission; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.flowchart_submission ( + id text NOT NULL, + mermaid_code text NOT NULL, + flowchart_data jsonb NOT NULL, + status integer NOT NULL, + create_time timestamp with time zone NOT NULL, + ai_score double precision, + ai_grade character varying(10), + ai_feedback text, + ai_suggestions text, + ai_criteria_details jsonb NOT NULL, + ai_provider character varying(50) NOT NULL, + ai_model character varying(50) NOT NULL, + processing_time double precision, + evaluation_time timestamp with time zone, + problem_id integer NOT NULL, + user_id integer NOT NULL +); + + +-- +-- Name: judge_server; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.judge_server ( + id integer NOT NULL, + hostname text NOT NULL, + ip text, + judger_version text NOT NULL, + cpu_core integer NOT NULL, + memory_usage double precision NOT NULL, + cpu_usage double precision NOT NULL, + last_heartbeat timestamp with time zone NOT NULL, + create_time timestamp with time zone NOT NULL, + task_number integer NOT NULL, + service_url text, + is_disabled boolean NOT NULL +); + + +-- +-- Name: judge_server_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.judge_server_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: judge_server_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.judge_server_id_seq OWNED BY public.judge_server.id; + + +-- +-- Name: message; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.message ( + id integer NOT NULL, + message text NOT NULL, + create_time timestamp with time zone NOT NULL, + recipient_id integer NOT NULL, + sender_id integer NOT NULL, + submission_id text NOT NULL +); + + +-- +-- Name: message_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.message ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.message_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: options_sysoptions; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.options_sysoptions ( + id integer NOT NULL, + key text NOT NULL, + value jsonb NOT NULL +); + + +-- +-- Name: options_sysoptions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.options_sysoptions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: options_sysoptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.options_sysoptions_id_seq OWNED BY public.options_sysoptions.id; + + +-- +-- Name: problem; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.problem ( + id integer NOT NULL, + title text NOT NULL, + description text NOT NULL, + input_description text NOT NULL, + output_description text NOT NULL, + samples jsonb NOT NULL, + test_case_id text NOT NULL, + test_case_score jsonb NOT NULL, + hint text, + languages jsonb NOT NULL, + template jsonb NOT NULL, + create_time timestamp with time zone NOT NULL, + last_update_time timestamp with time zone, + time_limit integer NOT NULL, + memory_limit integer NOT NULL, + visible boolean DEFAULT true NOT NULL, + difficulty text NOT NULL, + source text, + submission_number bigint DEFAULT 0 NOT NULL, + accepted_number bigint DEFAULT 0 NOT NULL, + created_by_id integer NOT NULL, + _id text NOT NULL, + statistic_info jsonb DEFAULT '{}'::jsonb NOT NULL, + contest_id integer, + is_public boolean DEFAULT false NOT NULL, + share_submission boolean DEFAULT false NOT NULL, + prompt text, + answers jsonb, + allow_flowchart boolean DEFAULT false NOT NULL, + flowchart_data jsonb DEFAULT '{}'::jsonb NOT NULL, + flowchart_hint text, + mermaid_code text, + show_flowchart boolean DEFAULT false NOT NULL, + ast_rules jsonb, + sql_config jsonb, + sql_display jsonb +); + + +-- +-- Name: problem_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.problem_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: problem_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.problem_id_seq OWNED BY public.problem.id; + + +-- +-- Name: problem_tag; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.problem_tag ( + id integer NOT NULL, + name text NOT NULL +); + + +-- +-- Name: problem_tag_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.problem_tag_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: problem_tag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.problem_tag_id_seq OWNED BY public.problem_tag.id; + + +-- +-- Name: problem_tags; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.problem_tags ( + id integer NOT NULL, + problem_id integer NOT NULL, + problemtag_id integer NOT NULL +); + + +-- +-- Name: problem_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.problem_tags_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: problem_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.problem_tags_id_seq OWNED BY public.problem_tags.id; + + +-- +-- Name: problemset; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.problemset ( + id bigint NOT NULL, + title text NOT NULL, + description text NOT NULL, + create_time timestamp with time zone NOT NULL, + last_update_time timestamp with time zone NOT NULL, + visible boolean NOT NULL, + difficulty text NOT NULL, + status text NOT NULL, + created_by_id integer NOT NULL, + end_time timestamp with time zone +); + + +-- +-- Name: problemset_badge; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.problemset_badge ( + id bigint NOT NULL, + name text NOT NULL, + description text NOT NULL, + icon text NOT NULL, + condition_type text NOT NULL, + condition_value integer NOT NULL, + problemset_id bigint NOT NULL +); + + +-- +-- Name: problemset_badge_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.problemset_badge ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.problemset_badge_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: problemset_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.problemset ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.problemset_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: problemset_problem; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.problemset_problem ( + id bigint NOT NULL, + "order" integer NOT NULL, + is_required boolean NOT NULL, + score integer NOT NULL, + hint text, + problem_id integer NOT NULL, + problemset_id bigint NOT NULL +); + + +-- +-- Name: problemset_problem_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.problemset_problem ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.problemset_problem_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: problemset_progress; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.problemset_progress ( + id bigint NOT NULL, + join_time timestamp with time zone NOT NULL, + complete_time timestamp with time zone, + is_completed boolean NOT NULL, + progress_percentage double precision NOT NULL, + completed_problems_count integer NOT NULL, + total_problems_count integer NOT NULL, + total_score integer NOT NULL, + progress_detail jsonb NOT NULL, + problemset_id bigint NOT NULL, + user_id integer NOT NULL +); + + +-- +-- Name: problemset_progress_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.problemset_progress ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.problemset_progress_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: problemset_submission; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.problemset_submission ( + id bigint NOT NULL, + problem_id integer NOT NULL, + problemset_id bigint NOT NULL, + submission_id text NOT NULL, + user_id integer NOT NULL +); + + +-- +-- Name: problemset_submission_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.problemset_submission ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.problemset_submission_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: reaction; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.reaction ( + id integer NOT NULL, + type character varying(20) NOT NULL, + create_time timestamp with time zone NOT NULL, + problem_id integer NOT NULL, + user_id integer NOT NULL +); + + +-- +-- Name: reaction_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.reaction ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.reaction_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: submission; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.submission ( + id text NOT NULL, + contest_id integer, + problem_id integer NOT NULL, + create_time timestamp with time zone NOT NULL, + user_id integer NOT NULL, + code text NOT NULL, + result integer DEFAULT 6 NOT NULL, + info jsonb DEFAULT '{}'::jsonb NOT NULL, + language text NOT NULL, + shared boolean DEFAULT false NOT NULL, + statistic_info jsonb DEFAULT '{}'::jsonb NOT NULL, + username text NOT NULL, + ip text +); + + +-- +-- Name: tutorial; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.tutorial ( + id integer NOT NULL, + title character varying(128) NOT NULL, + content text NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + is_public boolean NOT NULL, + "order" integer NOT NULL, + created_by_id integer NOT NULL, + code text, + type character varying(10) NOT NULL +); + + +-- +-- Name: tutorial_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.tutorial ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.tutorial_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: user; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public."user" ( + id integer NOT NULL, + password character varying(128) NOT NULL, + last_login timestamp with time zone, + username text NOT NULL, + email text, + create_time timestamp with time zone, + admin_type text NOT NULL, + auth_token text, + open_api boolean DEFAULT false NOT NULL, + open_api_appkey text, + is_disabled boolean DEFAULT false NOT NULL, + problem_permission text NOT NULL, + session_keys jsonb DEFAULT '[]'::jsonb NOT NULL, + raw_password character varying(20), + class_name text +); + + +-- +-- Name: user_achievement; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.user_achievement ( + id bigint NOT NULL, + unlock_time timestamp with time zone NOT NULL, + backfilled boolean DEFAULT false NOT NULL, + notified boolean DEFAULT false NOT NULL, + achievement_id bigint NOT NULL, + user_id integer NOT NULL +); + + +-- +-- Name: user_achievement_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.user_achievement ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.user_achievement_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: user_badge; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.user_badge ( + id bigint NOT NULL, + earned_time timestamp with time zone NOT NULL, + badge_id bigint NOT NULL, + user_id integer NOT NULL +); + + +-- +-- Name: user_badge_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.user_badge ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.user_badge_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: user_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.user_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.user_id_seq OWNED BY public."user".id; + + +-- +-- Name: user_profile; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.user_profile ( + id integer NOT NULL, + acm_problems_status jsonb DEFAULT '{}'::jsonb NOT NULL, + avatar text NOT NULL, + blog character varying(200), + mood text, + accepted_number integer DEFAULT 0 NOT NULL, + submission_number integer DEFAULT 0 NOT NULL, + github text, + school text, + major text, + user_id integer NOT NULL, + real_name text, + language text +); + + +-- +-- Name: user_profile_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.user_profile_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: user_profile_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.user_profile_id_seq OWNED BY public.user_profile.id; + + +-- +-- Name: user_stat; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.user_stat ( + id bigint NOT NULL, + metrics jsonb DEFAULT '{}'::jsonb NOT NULL, + update_time timestamp with time zone NOT NULL, + user_id integer NOT NULL +); + + +-- +-- Name: user_stat_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.user_stat ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.user_stat_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + +-- +-- Name: acm_contest_rank id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.acm_contest_rank ALTER COLUMN id SET DEFAULT nextval('public.acm_contest_rank_id_seq'::regclass); + + +-- +-- Name: announcement id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.announcement ALTER COLUMN id SET DEFAULT nextval('public.announcement_id_seq'::regclass); + + +-- +-- Name: auth_group id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_group ALTER COLUMN id SET DEFAULT nextval('public.auth_group_id_seq'::regclass); + + +-- +-- Name: auth_group_permissions id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_group_permissions ALTER COLUMN id SET DEFAULT nextval('public.auth_group_permissions_id_seq'::regclass); + + +-- +-- Name: auth_permission id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_permission ALTER COLUMN id SET DEFAULT nextval('public.auth_permission_id_seq'::regclass); + + +-- +-- Name: contest id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contest ALTER COLUMN id SET DEFAULT nextval('public.contest_id_seq'::regclass); + + +-- +-- Name: contest_announcement id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contest_announcement ALTER COLUMN id SET DEFAULT nextval('public.contest_announcement_id_seq'::regclass); + + +-- +-- Name: django_content_type id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.django_content_type ALTER COLUMN id SET DEFAULT nextval('public.django_content_type_id_seq'::regclass); + + +-- +-- Name: judge_server id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.judge_server ALTER COLUMN id SET DEFAULT nextval('public.judge_server_id_seq'::regclass); + + +-- +-- Name: options_sysoptions id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.options_sysoptions ALTER COLUMN id SET DEFAULT nextval('public.options_sysoptions_id_seq'::regclass); + + +-- +-- Name: problem id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem ALTER COLUMN id SET DEFAULT nextval('public.problem_id_seq'::regclass); + + +-- +-- Name: problem_tag id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem_tag ALTER COLUMN id SET DEFAULT nextval('public.problem_tag_id_seq'::regclass); + + +-- +-- Name: problem_tags id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem_tags ALTER COLUMN id SET DEFAULT nextval('public.problem_tags_id_seq'::regclass); + + +-- +-- Name: user id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public."user" ALTER COLUMN id SET DEFAULT nextval('public.user_id_seq'::regclass); + + +-- +-- Name: user_profile id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_profile ALTER COLUMN id SET DEFAULT nextval('public.user_profile_id_seq'::regclass); + + +-- +-- Name: achievement achievement_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.achievement + ADD CONSTRAINT achievement_pkey PRIMARY KEY (id); + + +-- +-- Name: acm_contest_rank acm_contest_rank_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.acm_contest_rank + ADD CONSTRAINT acm_contest_rank_pkey PRIMARY KEY (id); + + +-- +-- Name: ai_analysis ai_analysis_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ai_analysis + ADD CONSTRAINT ai_analysis_pkey PRIMARY KEY (id); + + +-- +-- Name: announcement announcement_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.announcement + ADD CONSTRAINT announcement_pkey PRIMARY KEY (id); + + +-- +-- Name: auth_group auth_group_name_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_group + ADD CONSTRAINT auth_group_name_key UNIQUE (name); + + +-- +-- Name: auth_group_permissions auth_group_permissions_group_id_permission_id_0cd325b0_uniq; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_group_permissions + ADD CONSTRAINT auth_group_permissions_group_id_permission_id_0cd325b0_uniq UNIQUE (group_id, permission_id); + + +-- +-- Name: auth_group_permissions auth_group_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_group_permissions + ADD CONSTRAINT auth_group_permissions_pkey PRIMARY KEY (id); + + +-- +-- Name: auth_group auth_group_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_group + ADD CONSTRAINT auth_group_pkey PRIMARY KEY (id); + + +-- +-- Name: auth_permission auth_permission_content_type_id_codename_01ab375a_uniq; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_permission + ADD CONSTRAINT auth_permission_content_type_id_codename_01ab375a_uniq UNIQUE (content_type_id, codename); + + +-- +-- Name: auth_permission auth_permission_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_permission + ADD CONSTRAINT auth_permission_pkey PRIMARY KEY (id); + + +-- +-- Name: contest_announcement contest_announcement_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contest_announcement + ADD CONSTRAINT contest_announcement_pkey PRIMARY KEY (id); + + +-- +-- Name: contest contest_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contest + ADD CONSTRAINT contest_pkey PRIMARY KEY (id); + + +-- +-- Name: django_content_type django_content_type_app_label_model_76bd3d3b_uniq; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.django_content_type + ADD CONSTRAINT django_content_type_app_label_model_76bd3d3b_uniq UNIQUE (app_label, model); + + +-- +-- Name: django_content_type django_content_type_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.django_content_type + ADD CONSTRAINT django_content_type_pkey PRIMARY KEY (id); + + +-- +-- Name: django_dramatiq_task django_dramatiq_task_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.django_dramatiq_task + ADD CONSTRAINT django_dramatiq_task_pkey PRIMARY KEY (id); + + +-- +-- Name: django_migrations django_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.django_migrations + ADD CONSTRAINT django_migrations_pkey PRIMARY KEY (id); + + +-- +-- Name: django_session django_session_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.django_session + ADD CONSTRAINT django_session_pkey PRIMARY KEY (session_key); + + +-- +-- Name: exercise exercise_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.exercise + ADD CONSTRAINT exercise_pkey PRIMARY KEY (id); + + +-- +-- Name: flowchart_submission flowchart_submission_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.flowchart_submission + ADD CONSTRAINT flowchart_submission_pkey PRIMARY KEY (id); + + +-- +-- Name: judge_server judge_server_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.judge_server + ADD CONSTRAINT judge_server_pkey PRIMARY KEY (id); + + +-- +-- Name: message message_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.message + ADD CONSTRAINT message_pkey PRIMARY KEY (id); + + +-- +-- Name: options_sysoptions options_sysoptions_key_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.options_sysoptions + ADD CONSTRAINT options_sysoptions_key_key UNIQUE (key); + + +-- +-- Name: options_sysoptions options_sysoptions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.options_sysoptions + ADD CONSTRAINT options_sysoptions_pkey PRIMARY KEY (id); + + +-- +-- Name: problem problem_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem + ADD CONSTRAINT problem_pkey PRIMARY KEY (id); + + +-- +-- Name: problem_tag problem_tag_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem_tag + ADD CONSTRAINT problem_tag_pkey PRIMARY KEY (id); + + +-- +-- Name: problem_tags problem_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem_tags + ADD CONSTRAINT problem_tags_pkey PRIMARY KEY (id); + + +-- +-- Name: problem_tags problem_tags_problem_id_problemtag_id_318459d1_uniq; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem_tags + ADD CONSTRAINT problem_tags_problem_id_problemtag_id_318459d1_uniq UNIQUE (problem_id, problemtag_id); + + +-- +-- Name: problemset_badge problemset_badge_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_badge + ADD CONSTRAINT problemset_badge_pkey PRIMARY KEY (id); + + +-- +-- Name: problemset problemset_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset + ADD CONSTRAINT problemset_pkey PRIMARY KEY (id); + + +-- +-- Name: problemset_problem problemset_problem_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_problem + ADD CONSTRAINT problemset_problem_pkey PRIMARY KEY (id); + + +-- +-- Name: problemset_progress problemset_progress_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_progress + ADD CONSTRAINT problemset_progress_pkey PRIMARY KEY (id); + + +-- +-- Name: problemset_submission problemset_submission_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_submission + ADD CONSTRAINT problemset_submission_pkey PRIMARY KEY (id); + + +-- +-- Name: reaction reaction_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.reaction + ADD CONSTRAINT reaction_pkey PRIMARY KEY (id); + + +-- +-- Name: reaction reaction_problem_user_unique; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.reaction + ADD CONSTRAINT reaction_problem_user_unique UNIQUE (problem_id, user_id); + + +-- +-- Name: submission submission_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.submission + ADD CONSTRAINT submission_pkey PRIMARY KEY (id); + + +-- +-- Name: tutorial tutorial_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.tutorial + ADD CONSTRAINT tutorial_pkey PRIMARY KEY (id); + + +-- +-- Name: acm_contest_rank unique_acm_rank_user_contest; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.acm_contest_rank + ADD CONSTRAINT unique_acm_rank_user_contest UNIQUE (user_id, contest_id); + + +-- +-- Name: problem unique_problem_id_contest; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem + ADD CONSTRAINT unique_problem_id_contest UNIQUE (_id, contest_id); + + +-- +-- Name: problemset_problem unique_problemset_problem; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_problem + ADD CONSTRAINT unique_problemset_problem UNIQUE (problemset_id, problem_id); + + +-- +-- Name: problemset_progress unique_problemset_progress_user; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_progress + ADD CONSTRAINT unique_problemset_progress_user UNIQUE (problemset_id, user_id); + + +-- +-- Name: user_achievement unique_user_achievement; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_achievement + ADD CONSTRAINT unique_user_achievement UNIQUE (user_id, achievement_id); + + +-- +-- Name: user_badge unique_user_badge; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_badge + ADD CONSTRAINT unique_user_badge UNIQUE (user_id, badge_id); + + +-- +-- Name: user_achievement user_achievement_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_achievement + ADD CONSTRAINT user_achievement_pkey PRIMARY KEY (id); + + +-- +-- Name: user_badge user_badge_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_badge + ADD CONSTRAINT user_badge_pkey PRIMARY KEY (id); + + +-- +-- Name: user user_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public."user" + ADD CONSTRAINT user_pkey PRIMARY KEY (id); + + +-- +-- Name: user_profile user_profile_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_profile + ADD CONSTRAINT user_profile_pkey PRIMARY KEY (id); + + +-- +-- Name: user_profile user_profile_user_id_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_profile + ADD CONSTRAINT user_profile_user_id_key UNIQUE (user_id); + + +-- +-- Name: user_stat user_stat_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_stat + ADD CONSTRAINT user_stat_pkey PRIMARY KEY (id); + + +-- +-- Name: user_stat user_stat_user_id_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_stat + ADD CONSTRAINT user_stat_user_id_key UNIQUE (user_id); + + +-- +-- Name: user user_username_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public."user" + ADD CONSTRAINT user_username_key UNIQUE (username); + + +-- +-- Name: acm_contest_rank_contest_id_21030ccd; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX acm_contest_rank_contest_id_21030ccd ON public.acm_contest_rank USING btree (contest_id); + + +-- +-- Name: acm_contest_rank_user_id_40391ab2; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX acm_contest_rank_user_id_40391ab2 ON public.acm_contest_rank USING btree (user_id); + + +-- +-- Name: acm_rank_contest_user_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX acm_rank_contest_user_idx ON public.acm_contest_rank USING btree (contest_id, user_id); + + +-- +-- Name: acm_rank_order_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX acm_rank_order_idx ON public.acm_contest_rank USING btree (contest_id, accepted_number, total_time); + + +-- +-- Name: ai_analysis_user_id_3aa23011; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ai_analysis_user_id_3aa23011 ON public.ai_analysis USING btree (user_id); + + +-- +-- Name: announcement_created_by_id_359ccf50; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX announcement_created_by_id_359ccf50 ON public.announcement USING btree (created_by_id); + + +-- +-- Name: announcement_list_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX announcement_list_idx ON public.announcement USING btree (visible, top DESC, create_time DESC); + + +-- +-- Name: auth_group_name_a6ea08ec_like; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX auth_group_name_a6ea08ec_like ON public.auth_group USING btree (name varchar_pattern_ops); + + +-- +-- Name: auth_group_permissions_group_id_b120cbf9; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX auth_group_permissions_group_id_b120cbf9 ON public.auth_group_permissions USING btree (group_id); + + +-- +-- Name: auth_group_permissions_permission_id_84c5c92e; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX auth_group_permissions_permission_id_84c5c92e ON public.auth_group_permissions USING btree (permission_id); + + +-- +-- Name: auth_permission_content_type_id_2f476e4b; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX auth_permission_content_type_id_2f476e4b ON public.auth_permission USING btree (content_type_id); + + +-- +-- Name: contest_announcement_contest_id_a8cb419f; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX contest_announcement_contest_id_a8cb419f ON public.contest_announcement USING btree (contest_id); + + +-- +-- Name: contest_announcement_created_by_id_469a14ce; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX contest_announcement_created_by_id_469a14ce ON public.contest_announcement USING btree (created_by_id); + + +-- +-- Name: contest_create_time_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX contest_create_time_idx ON public.submission USING btree (contest_id, create_time DESC); + + +-- +-- Name: contest_created_by_id_a763ca7e; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX contest_created_by_id_a763ca7e ON public.contest USING btree (created_by_id); + + +-- +-- Name: django_dramatiq_task_updated_at_bb623596; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX django_dramatiq_task_updated_at_bb623596 ON public.django_dramatiq_task USING btree (updated_at); + + +-- +-- Name: django_session_expire_date_a5c62663; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX django_session_expire_date_a5c62663 ON public.django_session USING btree (expire_date); + + +-- +-- Name: django_session_session_key_c0390e0f_like; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX django_session_session_key_c0390e0f_like ON public.django_session USING btree (session_key varchar_pattern_ops); + + +-- +-- Name: exercise_tutorial_id_6fd04055; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX exercise_tutorial_id_6fd04055 ON public.exercise USING btree (tutorial_id); + + +-- +-- Name: flowchart_problem_time_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX flowchart_problem_time_idx ON public.flowchart_submission USING btree (problem_id, create_time); + + +-- +-- Name: flowchart_status_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX flowchart_status_idx ON public.flowchart_submission USING btree (status); + + +-- +-- Name: flowchart_submission_id_0dbfc4f9_like; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX flowchart_submission_id_0dbfc4f9_like ON public.flowchart_submission USING btree (id text_pattern_ops); + + +-- +-- Name: flowchart_submission_problem_id_8551edbf; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX flowchart_submission_problem_id_8551edbf ON public.flowchart_submission USING btree (problem_id); + + +-- +-- Name: flowchart_submission_user_id_225c83e8; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX flowchart_submission_user_id_225c83e8 ON public.flowchart_submission USING btree (user_id); + + +-- +-- Name: flowchart_user_time_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX flowchart_user_time_idx ON public.flowchart_submission USING btree (user_id, create_time); + + +-- +-- Name: message_recipient_id_2aa5dd76; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX message_recipient_id_2aa5dd76 ON public.message USING btree (recipient_id); + + +-- +-- Name: message_recipient_time_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX message_recipient_time_idx ON public.message USING btree (recipient_id, create_time); + + +-- +-- Name: message_sender_id_a2a2e825; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX message_sender_id_a2a2e825 ON public.message USING btree (sender_id); + + +-- +-- Name: message_submission_id_2fdf8a47; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX message_submission_id_2fdf8a47 ON public.message USING btree (submission_id); + + +-- +-- Name: message_submission_id_2fdf8a47_like; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX message_submission_id_2fdf8a47_like ON public.message USING btree (submission_id text_pattern_ops); + + +-- +-- Name: problem__id_919b1d80; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problem__id_919b1d80 ON public.problem USING btree (_id); + + +-- +-- Name: problem_contest_id_328e013a; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problem_contest_id_328e013a ON public.problem USING btree (contest_id); + + +-- +-- Name: problem_contest_visible_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problem_contest_visible_idx ON public.problem USING btree (contest_id, visible); + + +-- +-- Name: problem_created_by_id_cb362143; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problem_created_by_id_cb362143 ON public.problem USING btree (created_by_id); + + +-- +-- Name: problem_tag_name_ci_unique; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX problem_tag_name_ci_unique ON public.problem_tag USING btree (lower(name)); + + +-- +-- Name: problem_tags_problem_id_866ecb8d; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problem_tags_problem_id_866ecb8d ON public.problem_tags USING btree (problem_id); + + +-- +-- Name: problem_tags_problemtag_id_72d20571; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problem_tags_problemtag_id_72d20571 ON public.problem_tags USING btree (problemtag_id); + + +-- +-- Name: problem_user_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problem_user_idx ON public.submission USING btree (problem_id, user_id); + + +-- +-- Name: problem_visible_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problem_visible_idx ON public.problem USING btree (visible); + + +-- +-- Name: problemset__problem_1f39fa_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset__problem_1f39fa_idx ON public.problemset_submission USING btree (problemset_id, user_id); + + +-- +-- Name: problemset__problem_22f053_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset__problem_22f053_idx ON public.problemset_submission USING btree (problemset_id, problem_id); + + +-- +-- Name: problemset__user_id_2f1501_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset__user_id_2f1501_idx ON public.problemset_submission USING btree (user_id); + + +-- +-- Name: problemset_badge_problemset_id_6cb6c74f; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_badge_problemset_id_6cb6c74f ON public.problemset_badge USING btree (problemset_id); + + +-- +-- Name: problemset_created_by_id_01b5197f; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_created_by_id_01b5197f ON public.problemset USING btree (created_by_id); + + +-- +-- Name: problemset_problem_problem_id_fff2d686; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_problem_problem_id_fff2d686 ON public.problemset_problem USING btree (problem_id); + + +-- +-- Name: problemset_problem_problemset_id_350d17fb; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_problem_problemset_id_350d17fb ON public.problemset_problem USING btree (problemset_id); + + +-- +-- Name: problemset_progress_problemset_id_20a9632e; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_progress_problemset_id_20a9632e ON public.problemset_progress USING btree (problemset_id); + + +-- +-- Name: problemset_progress_user_id_c8041a80; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_progress_user_id_c8041a80 ON public.problemset_progress USING btree (user_id); + + +-- +-- Name: problemset_submission_problem_id_5629b105; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_submission_problem_id_5629b105 ON public.problemset_submission USING btree (problem_id); + + +-- +-- Name: problemset_submission_problemset_id_85290e17; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_submission_problemset_id_85290e17 ON public.problemset_submission USING btree (problemset_id); + + +-- +-- Name: problemset_submission_submission_id_78e2b807; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_submission_submission_id_78e2b807 ON public.problemset_submission USING btree (submission_id); + + +-- +-- Name: problemset_submission_submission_id_78e2b807_like; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_submission_submission_id_78e2b807_like ON public.problemset_submission USING btree (submission_id text_pattern_ops); + + +-- +-- Name: problemset_submission_user_id_915fc9c6; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX problemset_submission_user_id_915fc9c6 ON public.problemset_submission USING btree (user_id); + + +-- +-- Name: reaction_problem_id_a7f3b9f3; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX reaction_problem_id_a7f3b9f3 ON public.reaction USING btree (problem_id); + + +-- +-- Name: reaction_problem_type_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX reaction_problem_type_idx ON public.reaction USING btree (problem_id, type); + + +-- +-- Name: reaction_user_id_cfa7f469; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX reaction_user_id_cfa7f469 ON public.reaction USING btree (user_id); + + +-- +-- Name: submission_contest_id_775716d5; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX submission_contest_id_775716d5 ON public.submission USING btree (contest_id); + + +-- +-- Name: submission_problem_id_76847b55; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX submission_problem_id_76847b55 ON public.submission USING btree (problem_id); + + +-- +-- Name: submission_result_37e2f67a; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX submission_result_37e2f67a ON public.submission USING btree (result); + + +-- +-- Name: submission_user_id_3779a8c1; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX submission_user_id_3779a8c1 ON public.submission USING btree (user_id); + + +-- +-- Name: tutorial_created_by_id_07973cab; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX tutorial_created_by_id_07973cab ON public.tutorial USING btree (created_by_id); + + +-- +-- Name: user_achievement_achievement_id_29db600d; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_achievement_achievement_id_29db600d ON public.user_achievement USING btree (achievement_id); + + +-- +-- Name: user_achievement_user_id_b8ec7d6a; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_achievement_user_id_b8ec7d6a ON public.user_achievement USING btree (user_id); + + +-- +-- Name: user_achv_notified_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_achv_notified_idx ON public.user_achievement USING btree (user_id, notified); + + +-- +-- Name: user_achv_time_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_achv_time_idx ON public.user_achievement USING btree (user_id, unlock_time DESC); + + +-- +-- Name: user_badge_badge_id_92a983e9; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_badge_badge_id_92a983e9 ON public.user_badge USING btree (badge_id); + + +-- +-- Name: user_badge_user_id_a286d718; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_badge_user_id_a286d718 ON public.user_badge USING btree (user_id); + + +-- +-- Name: user_create_time_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_create_time_idx ON public.submission USING btree (user_id, create_time); + + +-- +-- Name: acm_contest_rank acm_contest_rank_contest_id_21030ccd_fk_contest_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.acm_contest_rank + ADD CONSTRAINT acm_contest_rank_contest_id_21030ccd_fk_contest_id FOREIGN KEY (contest_id) REFERENCES public.contest(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: acm_contest_rank acm_contest_rank_user_id_40391ab2_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.acm_contest_rank + ADD CONSTRAINT acm_contest_rank_user_id_40391ab2_fk_user_id FOREIGN KEY (user_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: ai_analysis ai_analysis_user_id_3aa23011_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ai_analysis + ADD CONSTRAINT ai_analysis_user_id_3aa23011_fk_user_id FOREIGN KEY (user_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: announcement announcement_created_by_id_359ccf50_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.announcement + ADD CONSTRAINT announcement_created_by_id_359ccf50_fk_user_id FOREIGN KEY (created_by_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: auth_group_permissions auth_group_permissio_permission_id_84c5c92e_fk_auth_perm; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_group_permissions + ADD CONSTRAINT auth_group_permissio_permission_id_84c5c92e_fk_auth_perm FOREIGN KEY (permission_id) REFERENCES public.auth_permission(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: auth_group_permissions auth_group_permissions_group_id_b120cbf9_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_group_permissions + ADD CONSTRAINT auth_group_permissions_group_id_b120cbf9_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES public.auth_group(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: auth_permission auth_permission_content_type_id_2f476e4b_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.auth_permission + ADD CONSTRAINT auth_permission_content_type_id_2f476e4b_fk_django_co FOREIGN KEY (content_type_id) REFERENCES public.django_content_type(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: contest_announcement contest_announcement_contest_id_a8cb419f_fk_contest_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contest_announcement + ADD CONSTRAINT contest_announcement_contest_id_a8cb419f_fk_contest_id FOREIGN KEY (contest_id) REFERENCES public.contest(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: contest_announcement contest_announcement_created_by_id_469a14ce_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contest_announcement + ADD CONSTRAINT contest_announcement_created_by_id_469a14ce_fk_user_id FOREIGN KEY (created_by_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: contest contest_created_by_id_a763ca7e_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contest + ADD CONSTRAINT contest_created_by_id_a763ca7e_fk_user_id FOREIGN KEY (created_by_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: exercise exercise_tutorial_id_6fd04055_fk_tutorial_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.exercise + ADD CONSTRAINT exercise_tutorial_id_6fd04055_fk_tutorial_id FOREIGN KEY (tutorial_id) REFERENCES public.tutorial(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: flowchart_submission flowchart_submission_problem_id_8551edbf_fk_problem_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.flowchart_submission + ADD CONSTRAINT flowchart_submission_problem_id_8551edbf_fk_problem_id FOREIGN KEY (problem_id) REFERENCES public.problem(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: flowchart_submission flowchart_submission_user_id_225c83e8_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.flowchart_submission + ADD CONSTRAINT flowchart_submission_user_id_225c83e8_fk_user_id FOREIGN KEY (user_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: message message_recipient_id_2aa5dd76_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.message + ADD CONSTRAINT message_recipient_id_2aa5dd76_fk_user_id FOREIGN KEY (recipient_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: message message_sender_id_a2a2e825_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.message + ADD CONSTRAINT message_sender_id_a2a2e825_fk_user_id FOREIGN KEY (sender_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: message message_submission_id_2fdf8a47_fk_submission_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.message + ADD CONSTRAINT message_submission_id_2fdf8a47_fk_submission_id FOREIGN KEY (submission_id) REFERENCES public.submission(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problem problem_contest_id_328e013a_fk_contest_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem + ADD CONSTRAINT problem_contest_id_328e013a_fk_contest_id FOREIGN KEY (contest_id) REFERENCES public.contest(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problem problem_created_by_id_cb362143_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem + ADD CONSTRAINT problem_created_by_id_cb362143_fk_user_id FOREIGN KEY (created_by_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problem_tags problem_tags_problem_id_866ecb8d_fk_problem_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem_tags + ADD CONSTRAINT problem_tags_problem_id_866ecb8d_fk_problem_id FOREIGN KEY (problem_id) REFERENCES public.problem(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problem_tags problem_tags_problemtag_id_72d20571_fk_problem_tag_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problem_tags + ADD CONSTRAINT problem_tags_problemtag_id_72d20571_fk_problem_tag_id FOREIGN KEY (problemtag_id) REFERENCES public.problem_tag(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problemset_badge problemset_badge_problemset_id_6cb6c74f_fk_problemset_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_badge + ADD CONSTRAINT problemset_badge_problemset_id_6cb6c74f_fk_problemset_id FOREIGN KEY (problemset_id) REFERENCES public.problemset(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problemset problemset_created_by_id_01b5197f_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset + ADD CONSTRAINT problemset_created_by_id_01b5197f_fk_user_id FOREIGN KEY (created_by_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problemset_problem problemset_problem_problem_id_fff2d686_fk_problem_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_problem + ADD CONSTRAINT problemset_problem_problem_id_fff2d686_fk_problem_id FOREIGN KEY (problem_id) REFERENCES public.problem(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problemset_problem problemset_problem_problemset_id_350d17fb_fk_problemset_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_problem + ADD CONSTRAINT problemset_problem_problemset_id_350d17fb_fk_problemset_id FOREIGN KEY (problemset_id) REFERENCES public.problemset(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problemset_progress problemset_progress_problemset_id_20a9632e_fk_problemset_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_progress + ADD CONSTRAINT problemset_progress_problemset_id_20a9632e_fk_problemset_id FOREIGN KEY (problemset_id) REFERENCES public.problemset(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problemset_progress problemset_progress_user_id_c8041a80_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_progress + ADD CONSTRAINT problemset_progress_user_id_c8041a80_fk_user_id FOREIGN KEY (user_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problemset_submission problemset_submission_problem_id_5629b105_fk_problem_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_submission + ADD CONSTRAINT problemset_submission_problem_id_5629b105_fk_problem_id FOREIGN KEY (problem_id) REFERENCES public.problem(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problemset_submission problemset_submission_problemset_id_85290e17_fk_problemset_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_submission + ADD CONSTRAINT problemset_submission_problemset_id_85290e17_fk_problemset_id FOREIGN KEY (problemset_id) REFERENCES public.problemset(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problemset_submission problemset_submission_submission_id_78e2b807_fk_submission_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_submission + ADD CONSTRAINT problemset_submission_submission_id_78e2b807_fk_submission_id FOREIGN KEY (submission_id) REFERENCES public.submission(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: problemset_submission problemset_submission_user_id_915fc9c6_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.problemset_submission + ADD CONSTRAINT problemset_submission_user_id_915fc9c6_fk_user_id FOREIGN KEY (user_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: reaction reaction_problem_id_a7f3b9f3_fk_problem_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.reaction + ADD CONSTRAINT reaction_problem_id_a7f3b9f3_fk_problem_id FOREIGN KEY (problem_id) REFERENCES public.problem(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: reaction reaction_user_id_cfa7f469_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.reaction + ADD CONSTRAINT reaction_user_id_cfa7f469_fk_user_id FOREIGN KEY (user_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: submission submission_contest_id_775716d5_fk_contest_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.submission + ADD CONSTRAINT submission_contest_id_775716d5_fk_contest_id FOREIGN KEY (contest_id) REFERENCES public.contest(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: submission submission_problem_id_76847b55_fk_problem_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.submission + ADD CONSTRAINT submission_problem_id_76847b55_fk_problem_id FOREIGN KEY (problem_id) REFERENCES public.problem(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: tutorial tutorial_created_by_id_07973cab_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.tutorial + ADD CONSTRAINT tutorial_created_by_id_07973cab_fk_user_id FOREIGN KEY (created_by_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: user_achievement user_achievement_achievement_id_29db600d_fk_achievement_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_achievement + ADD CONSTRAINT user_achievement_achievement_id_29db600d_fk_achievement_id FOREIGN KEY (achievement_id) REFERENCES public.achievement(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: user_achievement user_achievement_user_id_b8ec7d6a_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_achievement + ADD CONSTRAINT user_achievement_user_id_b8ec7d6a_fk_user_id FOREIGN KEY (user_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: user_badge user_badge_badge_id_92a983e9_fk_problemset_badge_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_badge + ADD CONSTRAINT user_badge_badge_id_92a983e9_fk_problemset_badge_id FOREIGN KEY (badge_id) REFERENCES public.problemset_badge(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: user_badge user_badge_user_id_a286d718_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_badge + ADD CONSTRAINT user_badge_user_id_a286d718_fk_user_id FOREIGN KEY (user_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: user_profile user_profile_user_id_8fdce8e2_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_profile + ADD CONSTRAINT user_profile_user_id_8fdce8e2_fk_user_id FOREIGN KEY (user_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: user_stat user_stat_user_id_73337fc0_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_stat + ADD CONSTRAINT user_stat_user_id_73337fc0_fk_user_id FOREIGN KEY (user_id) REFERENCES public."user"(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- PostgreSQL database dump complete +-- + +\unrestrict qEGJezae9dSRMFptmcVl4X7XfSkrcehS1gGgER2LLUmXbVTLOxqrxziRuYQs4bz +