Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- PostgreSQL database dump
- --
- -- Dumped from database version 11.6
- -- Dumped by pg_dump version 12.1
- 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;
- --
- -- Name: qry_athlete_last_best(integer); Type: FUNCTION; Schema: public; Owner: postgres
- --
- CREATE FUNCTION public.qry_athlete_last_best(_athlete_id integer) RETURNS TABLE(athlete_id integer, last_update date, event character varying, "time" interval, meet character varying, meet_date date)
- LANGUAGE plpgsql
- AS $$
- declare last_rank_date date := (select max(r.asofdate) from T_ATHLETE_RANK r where r.ATHLETE_ID = _athlete_id);
- begin
- return QUERY
- select
- a.athlete_id,
- a.asofdate as last_update,
- e."name" as "event",
- r."time",
- m."name" as meet,
- m."date" as meet_date
- from T_ATHLETE_RANK a
- inner join T_RESULT r on a.RESULT_ID = r.id
- inner join T_EVENT e on a.EVENT_ID = e.id
- inner join T_MEET m on r.MEET_ID = m.id
- where r.athlete_id = _athlete_id
- and a.asofdate = last_rank_date
- and "level"='country';
- end;
- $$;
- ALTER FUNCTION public.qry_athlete_last_best(_athlete_id integer) OWNER TO postgres;
- --
- -- Name: qry_athlete_last_rank(integer); Type: FUNCTION; Schema: public; Owner: postgres
- --
- CREATE FUNCTION public.qry_athlete_last_rank(_athlete_id integer) RETURNS TABLE(athlete_id integer, last_update date, event character varying, level character varying, rank integer)
- LANGUAGE plpgsql
- AS $$
- declare last_rank_date date := (select max(r.asofdate) from T_ATHLETE_RANK r where r.ATHLETE_ID = _athlete_id);
- begin
- return QUERY
- select
- r.athlete_id,
- r.asofdate as last_update,
- e.name as event,
- r.level,
- r.rank
- from T_ATHLETE_RANK r
- inner join T_EVENT e on r.EVENT_ID = e.id
- where r.athlete_id = _athlete_id
- and r.asofdate = last_rank_date;
- end;
- $$;
- ALTER FUNCTION public.qry_athlete_last_rank(_athlete_id integer) OWNER TO postgres;
- --
- -- Name: qry_athlete_last_score(integer); Type: FUNCTION; Schema: public; Owner: postgres
- --
- CREATE FUNCTION public.qry_athlete_last_score(_athlete_id integer) RETURNS TABLE(athlete_id integer, last_update date, level character varying, rank integer, score double precision)
- LANGUAGE plpgsql
- AS $$
- declare last_score_date date := (select max(sc.asofdate) from T_ATHLETE_SCORE sc where sc.ATHLETE_ID = _athlete_id);
- begin
- return QUERY
- select
- s.athlete_id,
- s.asofdate as last_update,
- s.level,
- s.rank,
- s.score
- from T_ATHLETE_LEADERBOARD s
- where s.athlete_id = _athlete_id
- and s.asofdate = last_score_date;
- end;
- $$;
- ALTER FUNCTION public.qry_athlete_last_score(_athlete_id integer) OWNER TO postgres;
- --
- -- Name: qry_athlete_leaderboard(date); Type: FUNCTION; Schema: public; Owner: postgres
- --
- CREATE FUNCTION public.qry_athlete_leaderboard(_asofdate date) RETURNS TABLE(asofdate date, level text, athlete_id integer, score double precision, rank bigint)
- LANGUAGE plpgsql
- AS $$
- declare last_date date := (select max(s.asofdate) from T_ATHLETE_SCORE s where s.asofdate <= _ASOFDATE);
- begin
- -- store best times in temp table
- CREATE TEMP TABLE IF NOT EXISTS temp_table AS
- SELECT last_date as asofdate, b.athlete_id, t.state, t.team_id, b.score
- FROM T_ATHLETE_SCORE b
- INNER JOIN T_ATHLETE a on b.athlete_id=a.ATHLETE_ID
- INNER JOIN t_team_mapping m on m.athlete_id = b.athlete_id
- INNER JOIN t_team t on t.team_id = m.team_id and t."level" <> 'state'
- where b.ASOFDATE = last_date
- ;
- return QUERY
- select
- c.asofdate,
- 'country' as level,
- c.athlete_id,
- c.score,
- row_number () over(partition by c.ASOFDATE order by c.score desc) "rank"
- from temp_table c
- union (
- select
- c.asofdate,
- 'state' as level,
- c.athlete_id,
- c.score,
- row_number () over(partition by c.asofdate, c.state order by c.score desc) "rank"
- from temp_table c
- )
- union (
- select
- c.asofdate,
- 'team' as level,
- c.athlete_id,
- c.score,
- row_number () over(partition by c.asofdate, c.team_id order by c.score desc) "rank"
- from temp_table c
- )
- order by level, "rank" ;
- drop table if exists temp_table;
- end;
- $$;
- ALTER FUNCTION public.qry_athlete_leaderboard(_asofdate date) OWNER TO postgres;
- --
- -- Name: qry_athlete_rankings(date, character varying); Type: FUNCTION; Schema: public; Owner: postgres
- --
- CREATE FUNCTION public.qry_athlete_rankings(_asofdate date, _season character varying) RETURNS TABLE(asofdate date, event_id integer, level text, gender character varying, athlete_id integer, result_id integer, rank bigint)
- LANGUAGE plpgsql
- AS $$
- begin
- -- store best times in temp table
- CREATE TEMP TABLE IF NOT EXISTS temp_table AS
- SELECT _asofdate as asofdate, b.event_id, b.athlete_id, a.gender, t.state, t.team_id, b.id as result_id, b.time as best_time
- FROM qry_best_time(_asofdate,_season) b
- INNER JOIN T_ATHLETE a on b.athlete_id=a.ATHLETE_ID
- INNER JOIN t_team_mapping m on m.athlete_id = b.athlete_id
- INNER JOIN t_team t on t.team_id = m.team_id and t."level" <> 'state';
- return QUERY
- select
- c.asofdate,
- c.event_id,
- 'country' as level,
- c.gender,
- c.athlete_id,
- c.result_id,
- row_number () over(partition by c.event_id, c.gender order by c.best_time asc) "rank"
- from temp_table c
- union (
- select
- c.asofdate,
- c.event_id,
- 'state' as level,
- c.gender,
- c.athlete_id,
- c.result_id,
- row_number () over(partition by c.event_id, c.state, c.gender order by c.best_time asc) "rank"
- from temp_table c
- )
- union (
- select
- c.asofdate,
- c.event_id,
- 'team' as level,
- c.gender,
- c.athlete_id,
- c.result_id,
- row_number () over(partition by c.event_id, c.team_id, c.gender order by c.best_time asc) "rank"
- from temp_table c
- )
- order by event_id, level, gender, "rank" ;
- drop table if exists temp_table;
- end;
- $$;
- ALTER FUNCTION public.qry_athlete_rankings(_asofdate date, _season character varying) OWNER TO postgres;
- --
- -- Name: qry_best_time(date, character varying, boolean); Type: FUNCTION; Schema: public; Owner: postgres
- --
- CREATE FUNCTION public.qry_best_time(_asofdate date, _season character varying, _all_time boolean DEFAULT false) RETURNS TABLE(id integer, athlete_id integer, event_id integer, meet_id integer, "time" interval)
- LANGUAGE plpgsql
- AS $$
- begin
- RETURN QUERY
- with cte as (
- select r.id,
- ROW_NUMBER () OVER(PARTITION BY r.athlete_id, r.event_id order by r."time" asc) r
- from T_RESULT r
- inner join T_MEET m on r.MEET_ID = m.ID
- where m.season=_season and m."date" <= _asofdate and ((_all_time=true) or (DATE_PART('year',m.date)=DATE_PART('year',_asofdate)))
- )
- SELECT
- r.id,
- r.athlete_id,
- r.event_id,
- r.meet_id,
- r."time"
- from t_result r
- inner join cte c on c.id=r.id
- where c.r=1
- order by r.event_id, r."time";
- END; $$;
- ALTER FUNCTION public.qry_best_time(_asofdate date, _season character varying, _all_time boolean) OWNER TO postgres;
- --
- -- Name: qry_state_leaderboard(date); Type: FUNCTION; Schema: public; Owner: postgres
- --
- CREATE FUNCTION public.qry_state_leaderboard(_asofdate date) RETURNS TABLE(asofdate date, level text, team_id integer, score double precision, rank bigint)
- LANGUAGE plpgsql
- AS $$
- declare last_date date := (select max(s.asofdate) from T_TEAM_SCORE s where s.asofdate <= _ASOFDATE);
- begin
- -- store best times in temp table
- CREATE TEMP TABLE IF NOT EXISTS temp_table as
- SELECT last_date as asofdate, s.team_id, t.state, t.country, s.score
- FROM T_TEAM_SCORE s
- inner join T_TEAM t on s.team_id = t.team_id
- where s.ASOFDATE = last_date and t."level" = 'state'
- ;
- return QUERY
- select
- c.asofdate,
- 'state-aggregate' as level,
- c.team_id,
- c.score,
- row_number () over(partition by c.asofdate order by c.score desc) "rank"
- from temp_table c
- order by level, "rank" ;
- drop table if exists temp_table;
- end;
- $$;
- ALTER FUNCTION public.qry_state_leaderboard(_asofdate date) OWNER TO postgres;
- --
- -- Name: qry_team_leaderboard(date); Type: FUNCTION; Schema: public; Owner: postgres
- --
- CREATE FUNCTION public.qry_team_leaderboard(_asofdate date) RETURNS TABLE(asofdate date, level text, team_id integer, score double precision, rank bigint)
- LANGUAGE plpgsql
- AS $$
- declare last_date date := (select max(s.asofdate) from T_TEAM_SCORE s where s.asofdate <= _ASOFDATE);
- begin
- -- store best times in temp table
- CREATE TEMP TABLE IF NOT EXISTS temp_table as
- SELECT last_date as asofdate, s.team_id, t.state, t.country, s.score
- FROM T_TEAM_SCORE s
- inner join T_TEAM t on s.team_id = t.team_id
- where s.ASOFDATE = last_date and t."level" <> 'state'
- ;
- return QUERY
- select
- c.asofdate,
- 'country' as level,
- c.team_id,
- c.score,
- row_number () over(partition by c.asofdate order by c.score desc) "rank"
- from temp_table c
- union (
- select
- c.asofdate,
- 'state' as level,
- c.team_id,
- c.score,
- row_number () over(partition by c.asofdate, c.state order by c.score desc) "rank"
- from temp_table c
- )
- order by level, "rank" ;
- drop table if exists temp_table;
- end;
- $$;
- ALTER FUNCTION public.qry_team_leaderboard(_asofdate date) OWNER TO postgres;
- SET default_tablespace = '';
- --
- -- Name: auth_group; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.auth_group (
- id integer NOT NULL,
- name character varying(150) NOT NULL
- );
- ALTER TABLE public.auth_group OWNER TO postgres;
- --
- -- Name: auth_group_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.auth_group_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.auth_group_id_seq OWNER TO postgres;
- --
- -- Name: auth_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.auth_group_id_seq OWNED BY public.auth_group.id;
- --
- -- Name: auth_group_permissions; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.auth_group_permissions (
- id integer NOT NULL,
- group_id integer NOT NULL,
- permission_id integer NOT NULL
- );
- ALTER TABLE public.auth_group_permissions OWNER TO postgres;
- --
- -- Name: auth_group_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.auth_group_permissions_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.auth_group_permissions_id_seq OWNER TO postgres;
- --
- -- Name: auth_group_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.auth_group_permissions_id_seq OWNED BY public.auth_group_permissions.id;
- --
- -- Name: auth_permission; Type: TABLE; Schema: public; Owner: postgres
- --
- 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
- );
- ALTER TABLE public.auth_permission OWNER TO postgres;
- --
- -- Name: auth_permission_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.auth_permission_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.auth_permission_id_seq OWNER TO postgres;
- --
- -- Name: auth_permission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.auth_permission_id_seq OWNED BY public.auth_permission.id;
- --
- -- Name: authtoken_token; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.authtoken_token (
- key character varying(40) NOT NULL,
- created timestamp with time zone NOT NULL,
- user_id integer NOT NULL
- );
- ALTER TABLE public.authtoken_token OWNER TO postgres;
- --
- -- Name: django_admin_log; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.django_admin_log (
- id integer NOT NULL,
- action_time timestamp with time zone NOT NULL,
- object_id text,
- object_repr character varying(200) NOT NULL,
- action_flag smallint NOT NULL,
- change_message text NOT NULL,
- content_type_id integer,
- user_id integer NOT NULL,
- CONSTRAINT django_admin_log_action_flag_check CHECK ((action_flag >= 0))
- );
- ALTER TABLE public.django_admin_log OWNER TO postgres;
- --
- -- Name: django_admin_log_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.django_admin_log_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.django_admin_log_id_seq OWNER TO postgres;
- --
- -- Name: django_admin_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.django_admin_log_id_seq OWNED BY public.django_admin_log.id;
- --
- -- Name: django_content_type; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.django_content_type (
- id integer NOT NULL,
- app_label character varying(100) NOT NULL,
- model character varying(100) NOT NULL
- );
- ALTER TABLE public.django_content_type OWNER TO postgres;
- --
- -- Name: django_content_type_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.django_content_type_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.django_content_type_id_seq OWNER TO postgres;
- --
- -- Name: django_content_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.django_content_type_id_seq OWNED BY public.django_content_type.id;
- --
- -- Name: django_migrations; Type: TABLE; Schema: public; Owner: postgres
- --
- 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
- );
- ALTER TABLE public.django_migrations OWNER TO postgres;
- --
- -- Name: django_migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.django_migrations_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.django_migrations_id_seq OWNER TO postgres;
- --
- -- Name: django_migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.django_migrations_id_seq OWNED BY public.django_migrations.id;
- --
- -- Name: django_session; Type: TABLE; Schema: public; Owner: postgres
- --
- 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
- );
- ALTER TABLE public.django_session OWNER TO postgres;
- --
- -- Name: django_site; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.django_site (
- id integer NOT NULL,
- domain character varying(100) NOT NULL,
- name character varying(50) NOT NULL
- );
- ALTER TABLE public.django_site OWNER TO postgres;
- --
- -- Name: django_site_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.django_site_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.django_site_id_seq OWNER TO postgres;
- --
- -- Name: django_site_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.django_site_id_seq OWNED BY public.django_site.id;
- --
- -- Name: t_athlete; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_athlete (
- athlete_id integer NOT NULL,
- last_name character varying(100) NOT NULL,
- first_name character varying(100) NOT NULL,
- gender character varying(10),
- high_school_class integer,
- dob date,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- user_id integer
- );
- ALTER TABLE public.t_athlete OWNER TO postgres;
- --
- -- Name: t_athlete_athlete_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_athlete_athlete_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_athlete_athlete_id_seq OWNER TO postgres;
- --
- -- Name: t_athlete_athlete_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_athlete_athlete_id_seq OWNED BY public.t_athlete.athlete_id;
- --
- -- Name: t_athlete_leaderboard; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_athlete_leaderboard (
- id integer NOT NULL,
- asofdate date NOT NULL,
- level character varying(50) NOT NULL,
- rank integer NOT NULL,
- score double precision NOT NULL,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- athlete_id integer NOT NULL
- );
- ALTER TABLE public.t_athlete_leaderboard OWNER TO postgres;
- --
- -- Name: t_athlete_leaderboard_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_athlete_leaderboard_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_athlete_leaderboard_id_seq OWNER TO postgres;
- --
- -- Name: t_athlete_leaderboard_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_athlete_leaderboard_id_seq OWNED BY public.t_athlete_leaderboard.id;
- --
- -- Name: t_athlete_rank; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_athlete_rank (
- id integer NOT NULL,
- asofdate date NOT NULL,
- level character varying(50) NOT NULL,
- gender character varying(10) NOT NULL,
- rank integer NOT NULL,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- athlete_id integer NOT NULL,
- event_id integer NOT NULL,
- result_id integer NOT NULL
- );
- ALTER TABLE public.t_athlete_rank OWNER TO postgres;
- --
- -- Name: t_athlete_rank_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_athlete_rank_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_athlete_rank_id_seq OWNER TO postgres;
- --
- -- Name: t_athlete_rank_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_athlete_rank_id_seq OWNED BY public.t_athlete_rank.id;
- --
- -- Name: t_athlete_score; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_athlete_score (
- id integer NOT NULL,
- asofdate date NOT NULL,
- score double precision NOT NULL,
- streak integer NOT NULL,
- multiplier double precision NOT NULL,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- athlete_id integer NOT NULL
- );
- ALTER TABLE public.t_athlete_score OWNER TO postgres;
- --
- -- Name: t_athlete_score_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_athlete_score_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_athlete_score_id_seq OWNER TO postgres;
- --
- -- Name: t_athlete_score_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_athlete_score_id_seq OWNED BY public.t_athlete_score.id;
- --
- -- Name: t_coach; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_coach (
- coach_id integer NOT NULL,
- last_name character varying(100) NOT NULL,
- first_name character varying(100) NOT NULL,
- "position" character varying(100) NOT NULL,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- user_id integer
- );
- ALTER TABLE public.t_coach OWNER TO postgres;
- --
- -- Name: t_coach_coach_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_coach_coach_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_coach_coach_id_seq OWNER TO postgres;
- --
- -- Name: t_coach_coach_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_coach_coach_id_seq OWNED BY public.t_coach.coach_id;
- --
- -- Name: t_event; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_event (
- id integer NOT NULL,
- name character varying(100) NOT NULL,
- event_type character varying(50) NOT NULL,
- category character varying(50) NOT NULL,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL
- );
- ALTER TABLE public.t_event OWNER TO postgres;
- --
- -- Name: t_event_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_event_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_event_id_seq OWNER TO postgres;
- --
- -- Name: t_event_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_event_id_seq OWNED BY public.t_event.id;
- --
- -- Name: t_fan; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_fan (
- fan_id integer NOT NULL,
- last_name character varying(100) NOT NULL,
- first_name character varying(100) NOT NULL,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- user_id integer
- );
- ALTER TABLE public.t_fan OWNER TO postgres;
- --
- -- Name: t_fan_fan_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_fan_fan_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_fan_fan_id_seq OWNER TO postgres;
- --
- -- Name: t_fan_fan_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_fan_fan_id_seq OWNED BY public.t_fan.fan_id;
- --
- -- Name: t_meet; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_meet (
- id integer NOT NULL,
- name character varying(100) NOT NULL,
- date date NOT NULL,
- season character varying(60),
- venue character varying(100),
- city character varying(100),
- state character varying(50),
- country character varying(100) NOT NULL,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL
- );
- ALTER TABLE public.t_meet OWNER TO postgres;
- --
- -- Name: t_meet_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_meet_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_meet_id_seq OWNER TO postgres;
- --
- -- Name: t_meet_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_meet_id_seq OWNED BY public.t_meet.id;
- --
- -- Name: t_result; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_result (
- id integer NOT NULL,
- "time" interval,
- distance double precision,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- athlete_id integer NOT NULL,
- event_id integer NOT NULL,
- meet_id integer NOT NULL
- );
- ALTER TABLE public.t_result OWNER TO postgres;
- --
- -- Name: t_result_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_result_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_result_id_seq OWNER TO postgres;
- --
- -- Name: t_result_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_result_id_seq OWNED BY public.t_result.id;
- --
- -- Name: t_team; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_team (
- team_id integer NOT NULL,
- name character varying(100) NOT NULL,
- level character varying(50),
- city character varying(200),
- state character varying(50),
- country character varying(200),
- source character varying(100),
- link character varying(200),
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL
- );
- ALTER TABLE public.t_team OWNER TO postgres;
- --
- -- Name: t_team_coach_mapping; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_team_coach_mapping (
- id integer NOT NULL,
- date date,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- coach_id integer NOT NULL,
- team_id integer NOT NULL
- );
- ALTER TABLE public.t_team_coach_mapping OWNER TO postgres;
- --
- -- Name: t_team_coach_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_team_coach_mapping_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_team_coach_mapping_id_seq OWNER TO postgres;
- --
- -- Name: t_team_coach_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_team_coach_mapping_id_seq OWNED BY public.t_team_coach_mapping.id;
- --
- -- Name: t_team_leaderboard; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_team_leaderboard (
- id integer NOT NULL,
- asofdate date NOT NULL,
- level character varying(50) NOT NULL,
- rank integer NOT NULL,
- score double precision NOT NULL,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- team_id integer NOT NULL
- );
- ALTER TABLE public.t_team_leaderboard OWNER TO postgres;
- --
- -- Name: t_team_leaderboard_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_team_leaderboard_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_team_leaderboard_id_seq OWNER TO postgres;
- --
- -- Name: t_team_leaderboard_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_team_leaderboard_id_seq OWNED BY public.t_team_leaderboard.id;
- --
- -- Name: t_team_mapping; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_team_mapping (
- id integer NOT NULL,
- date date,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- athlete_id integer NOT NULL,
- team_id integer NOT NULL
- );
- ALTER TABLE public.t_team_mapping OWNER TO postgres;
- --
- -- Name: t_team_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_team_mapping_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_team_mapping_id_seq OWNER TO postgres;
- --
- -- Name: t_team_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_team_mapping_id_seq OWNED BY public.t_team_mapping.id;
- --
- -- Name: t_team_score; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_team_score (
- id integer NOT NULL,
- asofdate date NOT NULL,
- score double precision NOT NULL,
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL,
- team_id integer NOT NULL
- );
- ALTER TABLE public.t_team_score OWNER TO postgres;
- --
- -- Name: t_team_score_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_team_score_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_team_score_id_seq OWNER TO postgres;
- --
- -- Name: t_team_score_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_team_score_id_seq OWNED BY public.t_team_score.id;
- --
- -- Name: t_team_team_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_team_team_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_team_team_id_seq OWNER TO postgres;
- --
- -- Name: t_team_team_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_team_team_id_seq OWNED BY public.t_team.team_id;
- --
- -- Name: t_user; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_user (
- password character varying(128) NOT NULL,
- last_login timestamp with time zone,
- is_superuser boolean NOT NULL,
- username character varying(150) NOT NULL,
- first_name character varying(30) NOT NULL,
- last_name character varying(150) NOT NULL,
- email character varying(254) NOT NULL,
- is_staff boolean NOT NULL,
- is_active boolean NOT NULL,
- date_joined timestamp with time zone NOT NULL,
- user_id integer NOT NULL,
- role character varying(10) NOT NULL,
- gender character varying(10),
- dob date,
- height_inches integer,
- weight_lbs integer,
- city character varying(100),
- state character varying(50),
- country character varying(200),
- "insertTs" timestamp with time zone NOT NULL,
- "updateTs" timestamp with time zone NOT NULL
- );
- ALTER TABLE public.t_user OWNER TO postgres;
- --
- -- Name: t_user_groups; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_user_groups (
- id integer NOT NULL,
- user_id integer NOT NULL,
- group_id integer NOT NULL
- );
- ALTER TABLE public.t_user_groups OWNER TO postgres;
- --
- -- Name: t_user_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_user_groups_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_user_groups_id_seq OWNER TO postgres;
- --
- -- Name: t_user_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_user_groups_id_seq OWNED BY public.t_user_groups.id;
- --
- -- Name: t_user_user_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_user_user_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_user_user_id_seq OWNER TO postgres;
- --
- -- Name: t_user_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_user_user_id_seq OWNED BY public.t_user.user_id;
- --
- -- Name: t_user_user_permissions; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.t_user_user_permissions (
- id integer NOT NULL,
- user_id integer NOT NULL,
- permission_id integer NOT NULL
- );
- ALTER TABLE public.t_user_user_permissions OWNER TO postgres;
- --
- -- Name: t_user_user_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.t_user_user_permissions_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.t_user_user_permissions_id_seq OWNER TO postgres;
- --
- -- Name: t_user_user_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.t_user_user_permissions_id_seq OWNED BY public.t_user_user_permissions.id;
- --
- -- Name: vw_athlete_states; Type: VIEW; Schema: public; Owner: postgres
- --
- CREATE VIEW public.vw_athlete_states AS
- SELECT a.athlete_id,
- s.team_id,
- s.name AS team,
- s.level,
- s.state
- FROM (((public.t_athlete a
- JOIN public.t_team_mapping m ON ((a.athlete_id = m.athlete_id)))
- JOIN public.t_team t ON ((t.team_id = m.team_id)))
- JOIN public.t_team s ON ((((t.state)::text = (s.state)::text) AND ((s.level)::text = 'state'::text))))
- ORDER BY a.athlete_id;
- ALTER TABLE public.vw_athlete_states OWNER TO postgres;
- --
- -- Name: vw_athlete_teams; Type: VIEW; Schema: public; Owner: postgres
- --
- CREATE VIEW public.vw_athlete_teams AS
- SELECT a.athlete_id,
- a.last_name,
- a.first_name,
- a.gender,
- a.high_school_class,
- a.dob,
- t.team_id,
- t.name AS team,
- t.level,
- t.city,
- t.state,
- t.country
- FROM ((public.t_athlete a
- JOIN public.t_team_mapping m ON ((a.athlete_id = m.athlete_id)))
- JOIN public.t_team t ON ((t.team_id = m.team_id)))
- WHERE ((t.level)::text <> 'state'::text)
- ORDER BY a.athlete_id;
- ALTER TABLE public.vw_athlete_teams OWNER TO postgres;
- --
- -- Name: auth_group id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- 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: postgres
- --
- 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: postgres
- --
- ALTER TABLE ONLY public.auth_permission ALTER COLUMN id SET DEFAULT nextval('public.auth_permission_id_seq'::regclass);
- --
- -- Name: django_admin_log id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.django_admin_log ALTER COLUMN id SET DEFAULT nextval('public.django_admin_log_id_seq'::regclass);
- --
- -- Name: django_content_type id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.django_content_type ALTER COLUMN id SET DEFAULT nextval('public.django_content_type_id_seq'::regclass);
- --
- -- Name: django_migrations id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.django_migrations ALTER COLUMN id SET DEFAULT nextval('public.django_migrations_id_seq'::regclass);
- --
- -- Name: django_site id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.django_site ALTER COLUMN id SET DEFAULT nextval('public.django_site_id_seq'::regclass);
- --
- -- Name: t_athlete athlete_id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete ALTER COLUMN athlete_id SET DEFAULT nextval('public.t_athlete_athlete_id_seq'::regclass);
- --
- -- Name: t_athlete_leaderboard id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_leaderboard ALTER COLUMN id SET DEFAULT nextval('public.t_athlete_leaderboard_id_seq'::regclass);
- --
- -- Name: t_athlete_rank id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_rank ALTER COLUMN id SET DEFAULT nextval('public.t_athlete_rank_id_seq'::regclass);
- --
- -- Name: t_athlete_score id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_score ALTER COLUMN id SET DEFAULT nextval('public.t_athlete_score_id_seq'::regclass);
- --
- -- Name: t_coach coach_id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_coach ALTER COLUMN coach_id SET DEFAULT nextval('public.t_coach_coach_id_seq'::regclass);
- --
- -- Name: t_event id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_event ALTER COLUMN id SET DEFAULT nextval('public.t_event_id_seq'::regclass);
- --
- -- Name: t_fan fan_id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_fan ALTER COLUMN fan_id SET DEFAULT nextval('public.t_fan_fan_id_seq'::regclass);
- --
- -- Name: t_meet id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_meet ALTER COLUMN id SET DEFAULT nextval('public.t_meet_id_seq'::regclass);
- --
- -- Name: t_result id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_result ALTER COLUMN id SET DEFAULT nextval('public.t_result_id_seq'::regclass);
- --
- -- Name: t_team team_id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team ALTER COLUMN team_id SET DEFAULT nextval('public.t_team_team_id_seq'::regclass);
- --
- -- Name: t_team_coach_mapping id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_coach_mapping ALTER COLUMN id SET DEFAULT nextval('public.t_team_coach_mapping_id_seq'::regclass);
- --
- -- Name: t_team_leaderboard id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_leaderboard ALTER COLUMN id SET DEFAULT nextval('public.t_team_leaderboard_id_seq'::regclass);
- --
- -- Name: t_team_mapping id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_mapping ALTER COLUMN id SET DEFAULT nextval('public.t_team_mapping_id_seq'::regclass);
- --
- -- Name: t_team_score id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_score ALTER COLUMN id SET DEFAULT nextval('public.t_team_score_id_seq'::regclass);
- --
- -- Name: t_user user_id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user ALTER COLUMN user_id SET DEFAULT nextval('public.t_user_user_id_seq'::regclass);
- --
- -- Name: t_user_groups id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user_groups ALTER COLUMN id SET DEFAULT nextval('public.t_user_groups_id_seq'::regclass);
- --
- -- Name: t_user_user_permissions id; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user_user_permissions ALTER COLUMN id SET DEFAULT nextval('public.t_user_user_permissions_id_seq'::regclass);
- --
- -- Name: auth_group auth_group_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- 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: postgres
- --
- 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: postgres
- --
- 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: postgres
- --
- 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: postgres
- --
- 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: postgres
- --
- ALTER TABLE ONLY public.auth_permission
- ADD CONSTRAINT auth_permission_pkey PRIMARY KEY (id);
- --
- -- Name: authtoken_token authtoken_token_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.authtoken_token
- ADD CONSTRAINT authtoken_token_pkey PRIMARY KEY (key);
- --
- -- Name: authtoken_token authtoken_token_user_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.authtoken_token
- ADD CONSTRAINT authtoken_token_user_id_key UNIQUE (user_id);
- --
- -- Name: django_admin_log django_admin_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.django_admin_log
- ADD CONSTRAINT django_admin_log_pkey PRIMARY KEY (id);
- --
- -- Name: django_content_type django_content_type_app_label_model_76bd3d3b_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- 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: postgres
- --
- ALTER TABLE ONLY public.django_content_type
- ADD CONSTRAINT django_content_type_pkey PRIMARY KEY (id);
- --
- -- Name: django_migrations django_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- 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: postgres
- --
- ALTER TABLE ONLY public.django_session
- ADD CONSTRAINT django_session_pkey PRIMARY KEY (session_key);
- --
- -- Name: django_site django_site_domain_a2e37b91_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.django_site
- ADD CONSTRAINT django_site_domain_a2e37b91_uniq UNIQUE (domain);
- --
- -- Name: django_site django_site_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.django_site
- ADD CONSTRAINT django_site_pkey PRIMARY KEY (id);
- --
- -- Name: t_athlete_leaderboard t_athlete_leaderboard_asofdate_level_athlete_id_30ac532a_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_leaderboard
- ADD CONSTRAINT t_athlete_leaderboard_asofdate_level_athlete_id_30ac532a_uniq UNIQUE (asofdate, level, athlete_id);
- --
- -- Name: t_athlete_leaderboard t_athlete_leaderboard_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_leaderboard
- ADD CONSTRAINT t_athlete_leaderboard_pkey PRIMARY KEY (id);
- --
- -- Name: t_athlete t_athlete_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete
- ADD CONSTRAINT t_athlete_pkey PRIMARY KEY (athlete_id);
- --
- -- Name: t_athlete_rank t_athlete_rank_asofdate_event_id_level__1a9f0ebf_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_rank
- ADD CONSTRAINT t_athlete_rank_asofdate_event_id_level__1a9f0ebf_uniq UNIQUE (asofdate, event_id, level, gender, athlete_id);
- --
- -- Name: t_athlete_rank t_athlete_rank_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_rank
- ADD CONSTRAINT t_athlete_rank_pkey PRIMARY KEY (id);
- --
- -- Name: t_athlete_score t_athlete_score_asofdate_athlete_id_beba1d9d_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_score
- ADD CONSTRAINT t_athlete_score_asofdate_athlete_id_beba1d9d_uniq UNIQUE (asofdate, athlete_id);
- --
- -- Name: t_athlete_score t_athlete_score_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_score
- ADD CONSTRAINT t_athlete_score_pkey PRIMARY KEY (id);
- --
- -- Name: t_coach t_coach_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_coach
- ADD CONSTRAINT t_coach_pkey PRIMARY KEY (coach_id);
- --
- -- Name: t_event t_event_name_event_type_04c7cb64_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_event
- ADD CONSTRAINT t_event_name_event_type_04c7cb64_uniq UNIQUE (name, event_type);
- --
- -- Name: t_event t_event_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_event
- ADD CONSTRAINT t_event_pkey PRIMARY KEY (id);
- --
- -- Name: t_fan t_fan_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_fan
- ADD CONSTRAINT t_fan_pkey PRIMARY KEY (fan_id);
- --
- -- Name: t_meet t_meet_name_date_fca1a922_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_meet
- ADD CONSTRAINT t_meet_name_date_fca1a922_uniq UNIQUE (name, date);
- --
- -- Name: t_meet t_meet_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_meet
- ADD CONSTRAINT t_meet_pkey PRIMARY KEY (id);
- --
- -- Name: t_result t_result_meet_id_event_id_athlete_id_1e231e5d_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_result
- ADD CONSTRAINT t_result_meet_id_event_id_athlete_id_1e231e5d_uniq UNIQUE (meet_id, event_id, athlete_id);
- --
- -- Name: t_result t_result_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_result
- ADD CONSTRAINT t_result_pkey PRIMARY KEY (id);
- --
- -- Name: t_team_coach_mapping t_team_coach_mapping_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_coach_mapping
- ADD CONSTRAINT t_team_coach_mapping_pkey PRIMARY KEY (id);
- --
- -- Name: t_team_coach_mapping t_team_coach_mapping_team_id_coach_id_date_0e5d97ef_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_coach_mapping
- ADD CONSTRAINT t_team_coach_mapping_team_id_coach_id_date_0e5d97ef_uniq UNIQUE (team_id, coach_id, date);
- --
- -- Name: t_team_leaderboard t_team_leaderboard_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_leaderboard
- ADD CONSTRAINT t_team_leaderboard_pkey PRIMARY KEY (id);
- --
- -- Name: t_team_leaderboard t_team_leaderboard_team_id_asofdate_level_8b7b5876_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_leaderboard
- ADD CONSTRAINT t_team_leaderboard_team_id_asofdate_level_8b7b5876_uniq UNIQUE (team_id, asofdate, level);
- --
- -- Name: t_team_mapping t_team_mapping_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_mapping
- ADD CONSTRAINT t_team_mapping_pkey PRIMARY KEY (id);
- --
- -- Name: t_team_mapping t_team_mapping_team_id_athlete_id_date_7207c7dd_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_mapping
- ADD CONSTRAINT t_team_mapping_team_id_athlete_id_date_7207c7dd_uniq UNIQUE (team_id, athlete_id, date);
- --
- -- Name: t_team t_team_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team
- ADD CONSTRAINT t_team_pkey PRIMARY KEY (team_id);
- --
- -- Name: t_team_score t_team_score_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_score
- ADD CONSTRAINT t_team_score_pkey PRIMARY KEY (id);
- --
- -- Name: t_team_score t_team_score_team_id_asofdate_8823f31b_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_score
- ADD CONSTRAINT t_team_score_team_id_asofdate_8823f31b_uniq UNIQUE (team_id, asofdate);
- --
- -- Name: t_user_groups t_user_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user_groups
- ADD CONSTRAINT t_user_groups_pkey PRIMARY KEY (id);
- --
- -- Name: t_user_groups t_user_groups_user_id_group_id_c723baf9_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user_groups
- ADD CONSTRAINT t_user_groups_user_id_group_id_c723baf9_uniq UNIQUE (user_id, group_id);
- --
- -- Name: t_user t_user_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user
- ADD CONSTRAINT t_user_pkey PRIMARY KEY (user_id);
- --
- -- Name: t_user_user_permissions t_user_user_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user_user_permissions
- ADD CONSTRAINT t_user_user_permissions_pkey PRIMARY KEY (id);
- --
- -- Name: t_user_user_permissions t_user_user_permissions_user_id_permission_id_1605a84a_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user_user_permissions
- ADD CONSTRAINT t_user_user_permissions_user_id_permission_id_1605a84a_uniq UNIQUE (user_id, permission_id);
- --
- -- Name: t_user t_user_username_key; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user
- ADD CONSTRAINT t_user_username_key UNIQUE (username);
- --
- -- Name: auth_group_name_a6ea08ec_like; Type: INDEX; Schema: public; Owner: postgres
- --
- 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: postgres
- --
- 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: postgres
- --
- 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: postgres
- --
- CREATE INDEX auth_permission_content_type_id_2f476e4b ON public.auth_permission USING btree (content_type_id);
- --
- -- Name: authtoken_token_key_10f0b77e_like; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX authtoken_token_key_10f0b77e_like ON public.authtoken_token USING btree (key varchar_pattern_ops);
- --
- -- Name: django_admin_log_content_type_id_c4bce8eb; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX django_admin_log_content_type_id_c4bce8eb ON public.django_admin_log USING btree (content_type_id);
- --
- -- Name: django_admin_log_user_id_c564eba6; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX django_admin_log_user_id_c564eba6 ON public.django_admin_log USING btree (user_id);
- --
- -- Name: django_session_expire_date_a5c62663; Type: INDEX; Schema: public; Owner: postgres
- --
- 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: postgres
- --
- CREATE INDEX django_session_session_key_c0390e0f_like ON public.django_session USING btree (session_key varchar_pattern_ops);
- --
- -- Name: django_site_domain_a2e37b91_like; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX django_site_domain_a2e37b91_like ON public.django_site USING btree (domain varchar_pattern_ops);
- --
- -- Name: t_athlete_l_level_f47234_idx; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_athlete_l_level_f47234_idx ON public.t_athlete_leaderboard USING btree (level, athlete_id);
- --
- -- Name: t_athlete_leaderboard_athlete_id_10a3b6dd; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_athlete_leaderboard_athlete_id_10a3b6dd ON public.t_athlete_leaderboard USING btree (athlete_id);
- --
- -- Name: t_athlete_r_athlete_78e395_idx; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_athlete_r_athlete_78e395_idx ON public.t_athlete_rank USING btree (athlete_id, asofdate);
- --
- -- Name: t_athlete_rank_athlete_id_0b901a4d; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_athlete_rank_athlete_id_0b901a4d ON public.t_athlete_rank USING btree (athlete_id);
- --
- -- Name: t_athlete_rank_event_id_56d3ab2a; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_athlete_rank_event_id_56d3ab2a ON public.t_athlete_rank USING btree (event_id);
- --
- -- Name: t_athlete_rank_result_id_abc7ca58; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_athlete_rank_result_id_abc7ca58 ON public.t_athlete_rank USING btree (result_id);
- --
- -- Name: t_athlete_score_athlete_id_0fa68c4d; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_athlete_score_athlete_id_0fa68c4d ON public.t_athlete_score USING btree (athlete_id);
- --
- -- Name: t_athlete_user_id_cb56d3b6; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_athlete_user_id_cb56d3b6 ON public.t_athlete USING btree (user_id);
- --
- -- Name: t_coach_user_id_532670ca; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_coach_user_id_532670ca ON public.t_coach USING btree (user_id);
- --
- -- Name: t_fan_user_id_3c8f7eb9; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_fan_user_id_3c8f7eb9 ON public.t_fan USING btree (user_id);
- --
- -- Name: t_result_athlete_127651_idx; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_result_athlete_127651_idx ON public.t_result USING btree (athlete_id);
- --
- -- Name: t_result_athlete_id_55d8c956; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_result_athlete_id_55d8c956 ON public.t_result USING btree (athlete_id);
- --
- -- Name: t_result_event_i_9ebcec_idx; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_result_event_i_9ebcec_idx ON public.t_result USING btree (event_id);
- --
- -- Name: t_result_event_id_9b25d41d; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_result_event_id_9b25d41d ON public.t_result USING btree (event_id);
- --
- -- Name: t_result_meet_id_3c9db0b7; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_result_meet_id_3c9db0b7 ON public.t_result USING btree (meet_id);
- --
- -- Name: t_team_coach_mapping_coach_id_9e6bdc2c; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_team_coach_mapping_coach_id_9e6bdc2c ON public.t_team_coach_mapping USING btree (coach_id);
- --
- -- Name: t_team_coach_mapping_team_id_32afe19b; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_team_coach_mapping_team_id_32afe19b ON public.t_team_coach_mapping USING btree (team_id);
- --
- -- Name: t_team_lead_level_5eac9c_idx; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_team_lead_level_5eac9c_idx ON public.t_team_leaderboard USING btree (level, team_id);
- --
- -- Name: t_team_leaderboard_team_id_20238bcd; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_team_leaderboard_team_id_20238bcd ON public.t_team_leaderboard USING btree (team_id);
- --
- -- Name: t_team_mapping_athlete_id_49b6b2bb; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_team_mapping_athlete_id_49b6b2bb ON public.t_team_mapping USING btree (athlete_id);
- --
- -- Name: t_team_mapping_team_id_cfca1792; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_team_mapping_team_id_cfca1792 ON public.t_team_mapping USING btree (team_id);
- --
- -- Name: t_team_score_team_id_c87c6316; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_team_score_team_id_c87c6316 ON public.t_team_score USING btree (team_id);
- --
- -- Name: t_user_groups_group_id_9bc1d710; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_user_groups_group_id_9bc1d710 ON public.t_user_groups USING btree (group_id);
- --
- -- Name: t_user_groups_user_id_f297e4a8; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_user_groups_user_id_f297e4a8 ON public.t_user_groups USING btree (user_id);
- --
- -- Name: t_user_user_permissions_permission_id_2fd0b058; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_user_user_permissions_permission_id_2fd0b058 ON public.t_user_user_permissions USING btree (permission_id);
- --
- -- Name: t_user_user_permissions_user_id_542a10c4; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_user_user_permissions_user_id_542a10c4 ON public.t_user_user_permissions USING btree (user_id);
- --
- -- Name: t_user_username_0920a77a_like; Type: INDEX; Schema: public; Owner: postgres
- --
- CREATE INDEX t_user_username_0920a77a_like ON public.t_user USING btree (username varchar_pattern_ops);
- --
- -- Name: auth_group_permissions auth_group_permissio_permission_id_84c5c92e_fk_auth_perm; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- 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: postgres
- --
- 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: postgres
- --
- 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: authtoken_token authtoken_token_user_id_35299eff_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.authtoken_token
- ADD CONSTRAINT authtoken_token_user_id_35299eff_fk_t_user_user_id FOREIGN KEY (user_id) REFERENCES public.t_user(user_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: django_admin_log django_admin_log_content_type_id_c4bce8eb_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.django_admin_log
- ADD CONSTRAINT django_admin_log_content_type_id_c4bce8eb_fk_django_co FOREIGN KEY (content_type_id) REFERENCES public.django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: django_admin_log django_admin_log_user_id_c564eba6_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.django_admin_log
- ADD CONSTRAINT django_admin_log_user_id_c564eba6_fk_t_user_user_id FOREIGN KEY (user_id) REFERENCES public.t_user(user_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_athlete_leaderboard t_athlete_leaderboar_athlete_id_10a3b6dd_fk_t_athlete; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_leaderboard
- ADD CONSTRAINT t_athlete_leaderboar_athlete_id_10a3b6dd_fk_t_athlete FOREIGN KEY (athlete_id) REFERENCES public.t_athlete(athlete_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_athlete_rank t_athlete_rank_athlete_id_0b901a4d_fk_t_athlete_athlete_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_rank
- ADD CONSTRAINT t_athlete_rank_athlete_id_0b901a4d_fk_t_athlete_athlete_id FOREIGN KEY (athlete_id) REFERENCES public.t_athlete(athlete_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_athlete_rank t_athlete_rank_event_id_56d3ab2a_fk_t_event_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_rank
- ADD CONSTRAINT t_athlete_rank_event_id_56d3ab2a_fk_t_event_id FOREIGN KEY (event_id) REFERENCES public.t_event(id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_athlete_rank t_athlete_rank_result_id_abc7ca58_fk_t_result_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_rank
- ADD CONSTRAINT t_athlete_rank_result_id_abc7ca58_fk_t_result_id FOREIGN KEY (result_id) REFERENCES public.t_result(id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_athlete_score t_athlete_score_athlete_id_0fa68c4d_fk_t_athlete_athlete_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete_score
- ADD CONSTRAINT t_athlete_score_athlete_id_0fa68c4d_fk_t_athlete_athlete_id FOREIGN KEY (athlete_id) REFERENCES public.t_athlete(athlete_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_athlete t_athlete_user_id_cb56d3b6_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_athlete
- ADD CONSTRAINT t_athlete_user_id_cb56d3b6_fk_t_user_user_id FOREIGN KEY (user_id) REFERENCES public.t_user(user_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_coach t_coach_user_id_532670ca_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_coach
- ADD CONSTRAINT t_coach_user_id_532670ca_fk_t_user_user_id FOREIGN KEY (user_id) REFERENCES public.t_user(user_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_fan t_fan_user_id_3c8f7eb9_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_fan
- ADD CONSTRAINT t_fan_user_id_3c8f7eb9_fk_t_user_user_id FOREIGN KEY (user_id) REFERENCES public.t_user(user_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_result t_result_athlete_id_55d8c956_fk_t_athlete_athlete_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_result
- ADD CONSTRAINT t_result_athlete_id_55d8c956_fk_t_athlete_athlete_id FOREIGN KEY (athlete_id) REFERENCES public.t_athlete(athlete_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_result t_result_event_id_9b25d41d_fk_t_event_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_result
- ADD CONSTRAINT t_result_event_id_9b25d41d_fk_t_event_id FOREIGN KEY (event_id) REFERENCES public.t_event(id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_result t_result_meet_id_3c9db0b7_fk_t_meet_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_result
- ADD CONSTRAINT t_result_meet_id_3c9db0b7_fk_t_meet_id FOREIGN KEY (meet_id) REFERENCES public.t_meet(id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_team_coach_mapping t_team_coach_mapping_coach_id_9e6bdc2c_fk_t_coach_coach_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_coach_mapping
- ADD CONSTRAINT t_team_coach_mapping_coach_id_9e6bdc2c_fk_t_coach_coach_id FOREIGN KEY (coach_id) REFERENCES public.t_coach(coach_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_team_coach_mapping t_team_coach_mapping_team_id_32afe19b_fk_t_team_team_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_coach_mapping
- ADD CONSTRAINT t_team_coach_mapping_team_id_32afe19b_fk_t_team_team_id FOREIGN KEY (team_id) REFERENCES public.t_team(team_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_team_leaderboard t_team_leaderboard_team_id_20238bcd_fk_t_team_team_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_leaderboard
- ADD CONSTRAINT t_team_leaderboard_team_id_20238bcd_fk_t_team_team_id FOREIGN KEY (team_id) REFERENCES public.t_team(team_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_team_mapping t_team_mapping_athlete_id_49b6b2bb_fk_t_athlete_athlete_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_mapping
- ADD CONSTRAINT t_team_mapping_athlete_id_49b6b2bb_fk_t_athlete_athlete_id FOREIGN KEY (athlete_id) REFERENCES public.t_athlete(athlete_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_team_mapping t_team_mapping_team_id_cfca1792_fk_t_team_team_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_mapping
- ADD CONSTRAINT t_team_mapping_team_id_cfca1792_fk_t_team_team_id FOREIGN KEY (team_id) REFERENCES public.t_team(team_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_team_score t_team_score_team_id_c87c6316_fk_t_team_team_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_team_score
- ADD CONSTRAINT t_team_score_team_id_c87c6316_fk_t_team_team_id FOREIGN KEY (team_id) REFERENCES public.t_team(team_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_user_groups t_user_groups_group_id_9bc1d710_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user_groups
- ADD CONSTRAINT t_user_groups_group_id_9bc1d710_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES public.auth_group(id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_user_groups t_user_groups_user_id_f297e4a8_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user_groups
- ADD CONSTRAINT t_user_groups_user_id_f297e4a8_fk_t_user_user_id FOREIGN KEY (user_id) REFERENCES public.t_user(user_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_user_user_permissions t_user_user_permissi_permission_id_2fd0b058_fk_auth_perm; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user_user_permissions
- ADD CONSTRAINT t_user_user_permissi_permission_id_2fd0b058_fk_auth_perm FOREIGN KEY (permission_id) REFERENCES public.auth_permission(id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- Name: t_user_user_permissions t_user_user_permissions_user_id_542a10c4_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.t_user_user_permissions
- ADD CONSTRAINT t_user_user_permissions_user_id_542a10c4_fk_t_user_user_id FOREIGN KEY (user_id) REFERENCES public.t_user(user_id) DEFERRABLE INITIALLY DEFERRED;
- --
- -- PostgreSQL database dump complete
- --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement