SHARE
TWEET

Untitled

a guest Feb 26th, 2020 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --
  2. -- PostgreSQL database dump
  3. --
  4.  
  5. -- Dumped from database version 11.6
  6. -- Dumped by pg_dump version 12.1
  7.  
  8. SET statement_timeout = 0;
  9. SET lock_timeout = 0;
  10. SET idle_in_transaction_session_timeout = 0;
  11. SET client_encoding = 'UTF8';
  12. SET standard_conforming_strings = on;
  13. SELECT pg_catalog.set_config('search_path', '', false);
  14. SET check_function_bodies = false;
  15. SET xmloption = content;
  16. SET client_min_messages = warning;
  17. SET row_security = off;
  18.  
  19. --
  20. -- Name: qry_athlete_last_best(integer); Type: FUNCTION; Schema: public; Owner: postgres
  21. --
  22.  
  23. 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)
  24.     LANGUAGE plpgsql
  25.     AS $$
  26. declare last_rank_date date := (select max(r.asofdate) from T_ATHLETE_RANK r where r.ATHLETE_ID = _athlete_id);
  27. begin
  28. return QUERY
  29. select
  30.         a.athlete_id,
  31.         a.asofdate as last_update,
  32.         e."name" as "event",
  33.         r."time",
  34.         m."name" as meet,
  35.         m."date" as meet_date
  36. from T_ATHLETE_RANK a
  37. inner join T_RESULT r on a.RESULT_ID = r.id
  38. inner join T_EVENT e on a.EVENT_ID = e.id
  39. inner join T_MEET m on r.MEET_ID = m.id
  40. where r.athlete_id = _athlete_id
  41. and a.asofdate = last_rank_date
  42. and "level"='country';
  43. end;
  44. $$;
  45.  
  46.  
  47. ALTER FUNCTION public.qry_athlete_last_best(_athlete_id integer) OWNER TO postgres;
  48.  
  49. --
  50. -- Name: qry_athlete_last_rank(integer); Type: FUNCTION; Schema: public; Owner: postgres
  51. --
  52.  
  53. 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)
  54.     LANGUAGE plpgsql
  55.     AS $$
  56. declare last_rank_date date := (select max(r.asofdate) from T_ATHLETE_RANK r where r.ATHLETE_ID = _athlete_id);
  57. begin
  58. return QUERY
  59. select
  60.     r.athlete_id,
  61.     r.asofdate as last_update,
  62.     e.name as event,
  63.     r.level,
  64.     r.rank
  65. from T_ATHLETE_RANK r
  66. inner join T_EVENT e on r.EVENT_ID = e.id
  67. where r.athlete_id = _athlete_id
  68. and r.asofdate = last_rank_date;
  69. end;
  70. $$;
  71.  
  72.  
  73. ALTER FUNCTION public.qry_athlete_last_rank(_athlete_id integer) OWNER TO postgres;
  74.  
  75. --
  76. -- Name: qry_athlete_last_score(integer); Type: FUNCTION; Schema: public; Owner: postgres
  77. --
  78.  
  79. 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)
  80.     LANGUAGE plpgsql
  81.     AS $$
  82. declare last_score_date date := (select max(sc.asofdate) from T_ATHLETE_SCORE sc where sc.ATHLETE_ID = _athlete_id);
  83. begin
  84. return QUERY
  85. select
  86.     s.athlete_id,
  87.     s.asofdate as last_update,
  88.     s.level,
  89.     s.rank,
  90.     s.score
  91. from T_ATHLETE_LEADERBOARD s
  92. where s.athlete_id = _athlete_id
  93. and s.asofdate = last_score_date;
  94. end;
  95. $$;
  96.  
  97.  
  98. ALTER FUNCTION public.qry_athlete_last_score(_athlete_id integer) OWNER TO postgres;
  99.  
  100. --
  101. -- Name: qry_athlete_leaderboard(date); Type: FUNCTION; Schema: public; Owner: postgres
  102. --
  103.  
  104. CREATE FUNCTION public.qry_athlete_leaderboard(_asofdate date) RETURNS TABLE(asofdate date, level text, athlete_id integer, score double precision, rank bigint)
  105.     LANGUAGE plpgsql
  106.     AS $$
  107. declare last_date date := (select max(s.asofdate) from T_ATHLETE_SCORE s where s.asofdate <= _ASOFDATE);
  108. begin
  109.  -- store best times in temp table
  110.  CREATE TEMP TABLE IF NOT EXISTS temp_table AS
  111.         SELECT last_date as asofdate, b.athlete_id, t.state, t.team_id, b.score
  112.         FROM T_ATHLETE_SCORE b
  113.         INNER JOIN T_ATHLETE a on b.athlete_id=a.ATHLETE_ID
  114.         INNER JOIN t_team_mapping m on  m.athlete_id = b.athlete_id
  115.         INNER JOIN t_team t on  t.team_id = m.team_id and t."level" <> 'state'
  116.         where b.ASOFDATE = last_date
  117.         ;
  118. return QUERY
  119. select
  120.     c.asofdate,
  121.     'country' as level,
  122.     c.athlete_id,
  123.     c.score,
  124.     row_number () over(partition by c.ASOFDATE order by c.score desc) "rank"
  125. from temp_table c
  126. union (
  127. select
  128.     c.asofdate,
  129.     'state' as level,
  130.     c.athlete_id,
  131.     c.score,
  132.     row_number () over(partition by c.asofdate, c.state order by c.score desc) "rank"
  133.     from temp_table c
  134.     )
  135. union (
  136. select
  137. c.asofdate,
  138. 'team' as level,
  139. c.athlete_id,
  140. c.score,
  141. row_number () over(partition by c.asofdate, c.team_id order by c.score desc) "rank"
  142. from temp_table c
  143. )
  144. order by level, "rank" ;
  145. drop table if exists temp_table;
  146. end;
  147. $$;
  148.  
  149.  
  150. ALTER FUNCTION public.qry_athlete_leaderboard(_asofdate date) OWNER TO postgres;
  151.  
  152. --
  153. -- Name: qry_athlete_rankings(date, character varying); Type: FUNCTION; Schema: public; Owner: postgres
  154. --
  155.  
  156. 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)
  157.     LANGUAGE plpgsql
  158.     AS $$
  159. begin
  160.  -- store best times in temp table
  161.  CREATE TEMP TABLE IF NOT EXISTS temp_table AS
  162.         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
  163.         FROM qry_best_time(_asofdate,_season) b
  164.         INNER JOIN T_ATHLETE a on b.athlete_id=a.ATHLETE_ID
  165.         INNER JOIN t_team_mapping m on  m.athlete_id = b.athlete_id
  166.         INNER JOIN t_team t on  t.team_id = m.team_id and t."level" <> 'state';
  167. return QUERY
  168. select
  169.     c.asofdate,
  170.     c.event_id,
  171.     'country' as level,
  172.     c.gender,
  173.     c.athlete_id,
  174.     c.result_id,
  175.     row_number () over(partition by c.event_id, c.gender order by c.best_time asc) "rank"
  176. from temp_table c
  177. union (
  178. select
  179.     c.asofdate,
  180.     c.event_id,
  181.     'state' as level,
  182.     c.gender,
  183.     c.athlete_id,
  184.     c.result_id,
  185.     row_number () over(partition by c.event_id, c.state, c.gender order by  c.best_time asc) "rank"
  186.     from temp_table c
  187.     )
  188. union (
  189. select
  190. c.asofdate,
  191. c.event_id,
  192. 'team' as level,
  193. c.gender,
  194. c.athlete_id,
  195. c.result_id,
  196. row_number () over(partition by c.event_id, c.team_id, c.gender order by c.best_time asc) "rank"
  197. from temp_table c
  198. )
  199. order by event_id, level, gender, "rank" ;
  200. drop table if exists temp_table;
  201. end;
  202.  
  203. $$;
  204.  
  205.  
  206. ALTER FUNCTION public.qry_athlete_rankings(_asofdate date, _season character varying) OWNER TO postgres;
  207.  
  208. --
  209. -- Name: qry_best_time(date, character varying, boolean); Type: FUNCTION; Schema: public; Owner: postgres
  210. --
  211.  
  212. 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)
  213.     LANGUAGE plpgsql
  214.     AS $$
  215. begin
  216.      RETURN QUERY
  217.      with cte as (
  218.         select r.id,
  219.         ROW_NUMBER () OVER(PARTITION BY r.athlete_id, r.event_id order by r."time" asc) r
  220.         from T_RESULT r
  221.         inner join T_MEET m on r.MEET_ID = m.ID
  222.         where m.season=_season and m."date" <= _asofdate and ((_all_time=true) or (DATE_PART('year',m.date)=DATE_PART('year',_asofdate)))
  223.      )
  224.      SELECT
  225.         r.id,
  226.         r.athlete_id,
  227.         r.event_id,
  228.         r.meet_id,
  229.         r."time"
  230.      from t_result r
  231.      inner join cte c on c.id=r.id
  232.      where c.r=1
  233.      order by r.event_id, r."time";
  234. END; $$;
  235.  
  236.  
  237. ALTER FUNCTION public.qry_best_time(_asofdate date, _season character varying, _all_time boolean) OWNER TO postgres;
  238.  
  239. --
  240. -- Name: qry_state_leaderboard(date); Type: FUNCTION; Schema: public; Owner: postgres
  241. --
  242.  
  243. CREATE FUNCTION public.qry_state_leaderboard(_asofdate date) RETURNS TABLE(asofdate date, level text, team_id integer, score double precision, rank bigint)
  244.     LANGUAGE plpgsql
  245.     AS $$
  246. declare last_date date := (select max(s.asofdate) from T_TEAM_SCORE s where s.asofdate <= _ASOFDATE);
  247. begin
  248.  -- store best times in temp table
  249.  CREATE TEMP TABLE IF NOT EXISTS temp_table as
  250.         SELECT last_date as asofdate, s.team_id, t.state, t.country, s.score
  251.         FROM T_TEAM_SCORE s
  252.         inner join T_TEAM t on s.team_id = t.team_id
  253.         where s.ASOFDATE = last_date and t."level" = 'state'
  254.         ;
  255. return QUERY
  256. select
  257.     c.asofdate,
  258.     'state-aggregate' as level,
  259.     c.team_id,
  260.     c.score,
  261.     row_number () over(partition by c.asofdate order by c.score desc) "rank"
  262. from temp_table c
  263. order by level, "rank" ;
  264. drop table if exists temp_table;
  265. end;
  266.  
  267. $$;
  268.  
  269.  
  270. ALTER FUNCTION public.qry_state_leaderboard(_asofdate date) OWNER TO postgres;
  271.  
  272. --
  273. -- Name: qry_team_leaderboard(date); Type: FUNCTION; Schema: public; Owner: postgres
  274. --
  275.  
  276. CREATE FUNCTION public.qry_team_leaderboard(_asofdate date) RETURNS TABLE(asofdate date, level text, team_id integer, score double precision, rank bigint)
  277.     LANGUAGE plpgsql
  278.     AS $$
  279. declare last_date date := (select max(s.asofdate) from T_TEAM_SCORE s where s.asofdate <= _ASOFDATE);
  280. begin
  281.  -- store best times in temp table
  282.  CREATE TEMP TABLE IF NOT EXISTS temp_table as
  283.         SELECT last_date as asofdate, s.team_id, t.state, t.country, s.score
  284.         FROM T_TEAM_SCORE s
  285.         inner join T_TEAM t on s.team_id = t.team_id
  286.         where s.ASOFDATE = last_date and t."level" <> 'state'
  287.         ;
  288. return QUERY
  289. select
  290.     c.asofdate,
  291.     'country' as level,
  292.     c.team_id,
  293.     c.score,
  294.     row_number () over(partition by c.asofdate order by c.score desc) "rank"
  295. from temp_table c
  296. union (
  297. select
  298.     c.asofdate,
  299.     'state' as level,
  300.     c.team_id,
  301.     c.score,
  302.     row_number () over(partition by c.asofdate, c.state order by c.score desc) "rank"
  303.     from temp_table c
  304. )
  305. order by level, "rank" ;
  306. drop table if exists temp_table;
  307. end;
  308.  
  309. $$;
  310.  
  311.  
  312. ALTER FUNCTION public.qry_team_leaderboard(_asofdate date) OWNER TO postgres;
  313.  
  314. SET default_tablespace = '';
  315.  
  316. --
  317. -- Name: auth_group; Type: TABLE; Schema: public; Owner: postgres
  318. --
  319.  
  320. CREATE TABLE public.auth_group (
  321.     id integer NOT NULL,
  322.     name character varying(150) NOT NULL
  323. );
  324.  
  325.  
  326. ALTER TABLE public.auth_group OWNER TO postgres;
  327.  
  328. --
  329. -- Name: auth_group_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  330. --
  331.  
  332. CREATE SEQUENCE public.auth_group_id_seq
  333.     AS integer
  334.     START WITH 1
  335.     INCREMENT BY 1
  336.     NO MINVALUE
  337.     NO MAXVALUE
  338.     CACHE 1;
  339.  
  340.  
  341. ALTER TABLE public.auth_group_id_seq OWNER TO postgres;
  342.  
  343. --
  344. -- Name: auth_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  345. --
  346.  
  347. ALTER SEQUENCE public.auth_group_id_seq OWNED BY public.auth_group.id;
  348.  
  349.  
  350. --
  351. -- Name: auth_group_permissions; Type: TABLE; Schema: public; Owner: postgres
  352. --
  353.  
  354. CREATE TABLE public.auth_group_permissions (
  355.     id integer NOT NULL,
  356.     group_id integer NOT NULL,
  357.     permission_id integer NOT NULL
  358. );
  359.  
  360.  
  361. ALTER TABLE public.auth_group_permissions OWNER TO postgres;
  362.  
  363. --
  364. -- Name: auth_group_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  365. --
  366.  
  367. CREATE SEQUENCE public.auth_group_permissions_id_seq
  368.     AS integer
  369.     START WITH 1
  370.     INCREMENT BY 1
  371.     NO MINVALUE
  372.     NO MAXVALUE
  373.     CACHE 1;
  374.  
  375.  
  376. ALTER TABLE public.auth_group_permissions_id_seq OWNER TO postgres;
  377.  
  378. --
  379. -- Name: auth_group_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  380. --
  381.  
  382. ALTER SEQUENCE public.auth_group_permissions_id_seq OWNED BY public.auth_group_permissions.id;
  383.  
  384.  
  385. --
  386. -- Name: auth_permission; Type: TABLE; Schema: public; Owner: postgres
  387. --
  388.  
  389. CREATE TABLE public.auth_permission (
  390.     id integer NOT NULL,
  391.     name character varying(255) NOT NULL,
  392.     content_type_id integer NOT NULL,
  393.     codename character varying(100) NOT NULL
  394. );
  395.  
  396.  
  397. ALTER TABLE public.auth_permission OWNER TO postgres;
  398.  
  399. --
  400. -- Name: auth_permission_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  401. --
  402.  
  403. CREATE SEQUENCE public.auth_permission_id_seq
  404.     AS integer
  405.     START WITH 1
  406.     INCREMENT BY 1
  407.     NO MINVALUE
  408.     NO MAXVALUE
  409.     CACHE 1;
  410.  
  411.  
  412. ALTER TABLE public.auth_permission_id_seq OWNER TO postgres;
  413.  
  414. --
  415. -- Name: auth_permission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  416. --
  417.  
  418. ALTER SEQUENCE public.auth_permission_id_seq OWNED BY public.auth_permission.id;
  419.  
  420.  
  421. --
  422. -- Name: authtoken_token; Type: TABLE; Schema: public; Owner: postgres
  423. --
  424.  
  425. CREATE TABLE public.authtoken_token (
  426.     key character varying(40) NOT NULL,
  427.     created timestamp with time zone NOT NULL,
  428.     user_id integer NOT NULL
  429. );
  430.  
  431.  
  432. ALTER TABLE public.authtoken_token OWNER TO postgres;
  433.  
  434. --
  435. -- Name: django_admin_log; Type: TABLE; Schema: public; Owner: postgres
  436. --
  437.  
  438. CREATE TABLE public.django_admin_log (
  439.     id integer NOT NULL,
  440.     action_time timestamp with time zone NOT NULL,
  441.     object_id text,
  442.     object_repr character varying(200) NOT NULL,
  443.     action_flag smallint NOT NULL,
  444.     change_message text NOT NULL,
  445.     content_type_id integer,
  446.     user_id integer NOT NULL,
  447.     CONSTRAINT django_admin_log_action_flag_check CHECK ((action_flag >= 0))
  448. );
  449.  
  450.  
  451. ALTER TABLE public.django_admin_log OWNER TO postgres;
  452.  
  453. --
  454. -- Name: django_admin_log_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  455. --
  456.  
  457. CREATE SEQUENCE public.django_admin_log_id_seq
  458.     AS integer
  459.     START WITH 1
  460.     INCREMENT BY 1
  461.     NO MINVALUE
  462.     NO MAXVALUE
  463.     CACHE 1;
  464.  
  465.  
  466. ALTER TABLE public.django_admin_log_id_seq OWNER TO postgres;
  467.  
  468. --
  469. -- Name: django_admin_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  470. --
  471.  
  472. ALTER SEQUENCE public.django_admin_log_id_seq OWNED BY public.django_admin_log.id;
  473.  
  474.  
  475. --
  476. -- Name: django_content_type; Type: TABLE; Schema: public; Owner: postgres
  477. --
  478.  
  479. CREATE TABLE public.django_content_type (
  480.     id integer NOT NULL,
  481.     app_label character varying(100) NOT NULL,
  482.     model character varying(100) NOT NULL
  483. );
  484.  
  485.  
  486. ALTER TABLE public.django_content_type OWNER TO postgres;
  487.  
  488. --
  489. -- Name: django_content_type_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  490. --
  491.  
  492. CREATE SEQUENCE public.django_content_type_id_seq
  493.     AS integer
  494.     START WITH 1
  495.     INCREMENT BY 1
  496.     NO MINVALUE
  497.     NO MAXVALUE
  498.     CACHE 1;
  499.  
  500.  
  501. ALTER TABLE public.django_content_type_id_seq OWNER TO postgres;
  502.  
  503. --
  504. -- Name: django_content_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  505. --
  506.  
  507. ALTER SEQUENCE public.django_content_type_id_seq OWNED BY public.django_content_type.id;
  508.  
  509.  
  510. --
  511. -- Name: django_migrations; Type: TABLE; Schema: public; Owner: postgres
  512. --
  513.  
  514. CREATE TABLE public.django_migrations (
  515.     id integer NOT NULL,
  516.     app character varying(255) NOT NULL,
  517.     name character varying(255) NOT NULL,
  518.     applied timestamp with time zone NOT NULL
  519. );
  520.  
  521.  
  522. ALTER TABLE public.django_migrations OWNER TO postgres;
  523.  
  524. --
  525. -- Name: django_migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  526. --
  527.  
  528. CREATE SEQUENCE public.django_migrations_id_seq
  529.     AS integer
  530.     START WITH 1
  531.     INCREMENT BY 1
  532.     NO MINVALUE
  533.     NO MAXVALUE
  534.     CACHE 1;
  535.  
  536.  
  537. ALTER TABLE public.django_migrations_id_seq OWNER TO postgres;
  538.  
  539. --
  540. -- Name: django_migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  541. --
  542.  
  543. ALTER SEQUENCE public.django_migrations_id_seq OWNED BY public.django_migrations.id;
  544.  
  545.  
  546. --
  547. -- Name: django_session; Type: TABLE; Schema: public; Owner: postgres
  548. --
  549.  
  550. CREATE TABLE public.django_session (
  551.     session_key character varying(40) NOT NULL,
  552.     session_data text NOT NULL,
  553.     expire_date timestamp with time zone NOT NULL
  554. );
  555.  
  556.  
  557. ALTER TABLE public.django_session OWNER TO postgres;
  558.  
  559. --
  560. -- Name: django_site; Type: TABLE; Schema: public; Owner: postgres
  561. --
  562.  
  563. CREATE TABLE public.django_site (
  564.     id integer NOT NULL,
  565.     domain character varying(100) NOT NULL,
  566.     name character varying(50) NOT NULL
  567. );
  568.  
  569.  
  570. ALTER TABLE public.django_site OWNER TO postgres;
  571.  
  572. --
  573. -- Name: django_site_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  574. --
  575.  
  576. CREATE SEQUENCE public.django_site_id_seq
  577.     AS integer
  578.     START WITH 1
  579.     INCREMENT BY 1
  580.     NO MINVALUE
  581.     NO MAXVALUE
  582.     CACHE 1;
  583.  
  584.  
  585. ALTER TABLE public.django_site_id_seq OWNER TO postgres;
  586.  
  587. --
  588. -- Name: django_site_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  589. --
  590.  
  591. ALTER SEQUENCE public.django_site_id_seq OWNED BY public.django_site.id;
  592.  
  593.  
  594. --
  595. -- Name: t_athlete; Type: TABLE; Schema: public; Owner: postgres
  596. --
  597.  
  598. CREATE TABLE public.t_athlete (
  599.     athlete_id integer NOT NULL,
  600.     last_name character varying(100) NOT NULL,
  601.     first_name character varying(100) NOT NULL,
  602.     gender character varying(10),
  603.     high_school_class integer,
  604.     dob date,
  605.     "insertTs" timestamp with time zone NOT NULL,
  606.     "updateTs" timestamp with time zone NOT NULL,
  607.     user_id integer
  608. );
  609.  
  610.  
  611. ALTER TABLE public.t_athlete OWNER TO postgres;
  612.  
  613. --
  614. -- Name: t_athlete_athlete_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  615. --
  616.  
  617. CREATE SEQUENCE public.t_athlete_athlete_id_seq
  618.     AS integer
  619.     START WITH 1
  620.     INCREMENT BY 1
  621.     NO MINVALUE
  622.     NO MAXVALUE
  623.     CACHE 1;
  624.  
  625.  
  626. ALTER TABLE public.t_athlete_athlete_id_seq OWNER TO postgres;
  627.  
  628. --
  629. -- Name: t_athlete_athlete_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  630. --
  631.  
  632. ALTER SEQUENCE public.t_athlete_athlete_id_seq OWNED BY public.t_athlete.athlete_id;
  633.  
  634.  
  635. --
  636. -- Name: t_athlete_leaderboard; Type: TABLE; Schema: public; Owner: postgres
  637. --
  638.  
  639. CREATE TABLE public.t_athlete_leaderboard (
  640.     id integer NOT NULL,
  641.     asofdate date NOT NULL,
  642.     level character varying(50) NOT NULL,
  643.     rank integer NOT NULL,
  644.     score double precision NOT NULL,
  645.     "insertTs" timestamp with time zone NOT NULL,
  646.     "updateTs" timestamp with time zone NOT NULL,
  647.     athlete_id integer NOT NULL
  648. );
  649.  
  650.  
  651. ALTER TABLE public.t_athlete_leaderboard OWNER TO postgres;
  652.  
  653. --
  654. -- Name: t_athlete_leaderboard_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  655. --
  656.  
  657. CREATE SEQUENCE public.t_athlete_leaderboard_id_seq
  658.     AS integer
  659.     START WITH 1
  660.     INCREMENT BY 1
  661.     NO MINVALUE
  662.     NO MAXVALUE
  663.     CACHE 1;
  664.  
  665.  
  666. ALTER TABLE public.t_athlete_leaderboard_id_seq OWNER TO postgres;
  667.  
  668. --
  669. -- Name: t_athlete_leaderboard_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  670. --
  671.  
  672. ALTER SEQUENCE public.t_athlete_leaderboard_id_seq OWNED BY public.t_athlete_leaderboard.id;
  673.  
  674.  
  675. --
  676. -- Name: t_athlete_rank; Type: TABLE; Schema: public; Owner: postgres
  677. --
  678.  
  679. CREATE TABLE public.t_athlete_rank (
  680.     id integer NOT NULL,
  681.     asofdate date NOT NULL,
  682.     level character varying(50) NOT NULL,
  683.     gender character varying(10) NOT NULL,
  684.     rank integer NOT NULL,
  685.     "insertTs" timestamp with time zone NOT NULL,
  686.     "updateTs" timestamp with time zone NOT NULL,
  687.     athlete_id integer NOT NULL,
  688.     event_id integer NOT NULL,
  689.     result_id integer NOT NULL
  690. );
  691.  
  692.  
  693. ALTER TABLE public.t_athlete_rank OWNER TO postgres;
  694.  
  695. --
  696. -- Name: t_athlete_rank_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  697. --
  698.  
  699. CREATE SEQUENCE public.t_athlete_rank_id_seq
  700.     AS integer
  701.     START WITH 1
  702.     INCREMENT BY 1
  703.     NO MINVALUE
  704.     NO MAXVALUE
  705.     CACHE 1;
  706.  
  707.  
  708. ALTER TABLE public.t_athlete_rank_id_seq OWNER TO postgres;
  709.  
  710. --
  711. -- Name: t_athlete_rank_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  712. --
  713.  
  714. ALTER SEQUENCE public.t_athlete_rank_id_seq OWNED BY public.t_athlete_rank.id;
  715.  
  716.  
  717. --
  718. -- Name: t_athlete_score; Type: TABLE; Schema: public; Owner: postgres
  719. --
  720.  
  721. CREATE TABLE public.t_athlete_score (
  722.     id integer NOT NULL,
  723.     asofdate date NOT NULL,
  724.     score double precision NOT NULL,
  725.     streak integer NOT NULL,
  726.     multiplier double precision NOT NULL,
  727.     "insertTs" timestamp with time zone NOT NULL,
  728.     "updateTs" timestamp with time zone NOT NULL,
  729.     athlete_id integer NOT NULL
  730. );
  731.  
  732.  
  733. ALTER TABLE public.t_athlete_score OWNER TO postgres;
  734.  
  735. --
  736. -- Name: t_athlete_score_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  737. --
  738.  
  739. CREATE SEQUENCE public.t_athlete_score_id_seq
  740.     AS integer
  741.     START WITH 1
  742.     INCREMENT BY 1
  743.     NO MINVALUE
  744.     NO MAXVALUE
  745.     CACHE 1;
  746.  
  747.  
  748. ALTER TABLE public.t_athlete_score_id_seq OWNER TO postgres;
  749.  
  750. --
  751. -- Name: t_athlete_score_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  752. --
  753.  
  754. ALTER SEQUENCE public.t_athlete_score_id_seq OWNED BY public.t_athlete_score.id;
  755.  
  756.  
  757. --
  758. -- Name: t_coach; Type: TABLE; Schema: public; Owner: postgres
  759. --
  760.  
  761. CREATE TABLE public.t_coach (
  762.     coach_id integer NOT NULL,
  763.     last_name character varying(100) NOT NULL,
  764.     first_name character varying(100) NOT NULL,
  765.     "position" character varying(100) NOT NULL,
  766.     "insertTs" timestamp with time zone NOT NULL,
  767.     "updateTs" timestamp with time zone NOT NULL,
  768.     user_id integer
  769. );
  770.  
  771.  
  772. ALTER TABLE public.t_coach OWNER TO postgres;
  773.  
  774. --
  775. -- Name: t_coach_coach_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  776. --
  777.  
  778. CREATE SEQUENCE public.t_coach_coach_id_seq
  779.     AS integer
  780.     START WITH 1
  781.     INCREMENT BY 1
  782.     NO MINVALUE
  783.     NO MAXVALUE
  784.     CACHE 1;
  785.  
  786.  
  787. ALTER TABLE public.t_coach_coach_id_seq OWNER TO postgres;
  788.  
  789. --
  790. -- Name: t_coach_coach_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  791. --
  792.  
  793. ALTER SEQUENCE public.t_coach_coach_id_seq OWNED BY public.t_coach.coach_id;
  794.  
  795.  
  796. --
  797. -- Name: t_event; Type: TABLE; Schema: public; Owner: postgres
  798. --
  799.  
  800. CREATE TABLE public.t_event (
  801.     id integer NOT NULL,
  802.     name character varying(100) NOT NULL,
  803.     event_type character varying(50) NOT NULL,
  804.     category character varying(50) NOT NULL,
  805.     "insertTs" timestamp with time zone NOT NULL,
  806.     "updateTs" timestamp with time zone NOT NULL
  807. );
  808.  
  809.  
  810. ALTER TABLE public.t_event OWNER TO postgres;
  811.  
  812. --
  813. -- Name: t_event_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  814. --
  815.  
  816. CREATE SEQUENCE public.t_event_id_seq
  817.     AS integer
  818.     START WITH 1
  819.     INCREMENT BY 1
  820.     NO MINVALUE
  821.     NO MAXVALUE
  822.     CACHE 1;
  823.  
  824.  
  825. ALTER TABLE public.t_event_id_seq OWNER TO postgres;
  826.  
  827. --
  828. -- Name: t_event_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  829. --
  830.  
  831. ALTER SEQUENCE public.t_event_id_seq OWNED BY public.t_event.id;
  832.  
  833.  
  834. --
  835. -- Name: t_fan; Type: TABLE; Schema: public; Owner: postgres
  836. --
  837.  
  838. CREATE TABLE public.t_fan (
  839.     fan_id integer NOT NULL,
  840.     last_name character varying(100) NOT NULL,
  841.     first_name character varying(100) NOT NULL,
  842.     "insertTs" timestamp with time zone NOT NULL,
  843.     "updateTs" timestamp with time zone NOT NULL,
  844.     user_id integer
  845. );
  846.  
  847.  
  848. ALTER TABLE public.t_fan OWNER TO postgres;
  849.  
  850. --
  851. -- Name: t_fan_fan_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  852. --
  853.  
  854. CREATE SEQUENCE public.t_fan_fan_id_seq
  855.     AS integer
  856.     START WITH 1
  857.     INCREMENT BY 1
  858.     NO MINVALUE
  859.     NO MAXVALUE
  860.     CACHE 1;
  861.  
  862.  
  863. ALTER TABLE public.t_fan_fan_id_seq OWNER TO postgres;
  864.  
  865. --
  866. -- Name: t_fan_fan_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  867. --
  868.  
  869. ALTER SEQUENCE public.t_fan_fan_id_seq OWNED BY public.t_fan.fan_id;
  870.  
  871.  
  872. --
  873. -- Name: t_meet; Type: TABLE; Schema: public; Owner: postgres
  874. --
  875.  
  876. CREATE TABLE public.t_meet (
  877.     id integer NOT NULL,
  878.     name character varying(100) NOT NULL,
  879.     date date NOT NULL,
  880.     season character varying(60),
  881.     venue character varying(100),
  882.     city character varying(100),
  883.     state character varying(50),
  884.     country character varying(100) NOT NULL,
  885.     "insertTs" timestamp with time zone NOT NULL,
  886.     "updateTs" timestamp with time zone NOT NULL
  887. );
  888.  
  889.  
  890. ALTER TABLE public.t_meet OWNER TO postgres;
  891.  
  892. --
  893. -- Name: t_meet_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  894. --
  895.  
  896. CREATE SEQUENCE public.t_meet_id_seq
  897.     AS integer
  898.     START WITH 1
  899.     INCREMENT BY 1
  900.     NO MINVALUE
  901.     NO MAXVALUE
  902.     CACHE 1;
  903.  
  904.  
  905. ALTER TABLE public.t_meet_id_seq OWNER TO postgres;
  906.  
  907. --
  908. -- Name: t_meet_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  909. --
  910.  
  911. ALTER SEQUENCE public.t_meet_id_seq OWNED BY public.t_meet.id;
  912.  
  913.  
  914. --
  915. -- Name: t_result; Type: TABLE; Schema: public; Owner: postgres
  916. --
  917.  
  918. CREATE TABLE public.t_result (
  919.     id integer NOT NULL,
  920.     "time" interval,
  921.     distance double precision,
  922.     "insertTs" timestamp with time zone NOT NULL,
  923.     "updateTs" timestamp with time zone NOT NULL,
  924.     athlete_id integer NOT NULL,
  925.     event_id integer NOT NULL,
  926.     meet_id integer NOT NULL
  927. );
  928.  
  929.  
  930. ALTER TABLE public.t_result OWNER TO postgres;
  931.  
  932. --
  933. -- Name: t_result_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  934. --
  935.  
  936. CREATE SEQUENCE public.t_result_id_seq
  937.     AS integer
  938.     START WITH 1
  939.     INCREMENT BY 1
  940.     NO MINVALUE
  941.     NO MAXVALUE
  942.     CACHE 1;
  943.  
  944.  
  945. ALTER TABLE public.t_result_id_seq OWNER TO postgres;
  946.  
  947. --
  948. -- Name: t_result_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  949. --
  950.  
  951. ALTER SEQUENCE public.t_result_id_seq OWNED BY public.t_result.id;
  952.  
  953.  
  954. --
  955. -- Name: t_team; Type: TABLE; Schema: public; Owner: postgres
  956. --
  957.  
  958. CREATE TABLE public.t_team (
  959.     team_id integer NOT NULL,
  960.     name character varying(100) NOT NULL,
  961.     level character varying(50),
  962.     city character varying(200),
  963.     state character varying(50),
  964.     country character varying(200),
  965.     source character varying(100),
  966.     link character varying(200),
  967.     "insertTs" timestamp with time zone NOT NULL,
  968.     "updateTs" timestamp with time zone NOT NULL
  969. );
  970.  
  971.  
  972. ALTER TABLE public.t_team OWNER TO postgres;
  973.  
  974. --
  975. -- Name: t_team_coach_mapping; Type: TABLE; Schema: public; Owner: postgres
  976. --
  977.  
  978. CREATE TABLE public.t_team_coach_mapping (
  979.     id integer NOT NULL,
  980.     date date,
  981.     "insertTs" timestamp with time zone NOT NULL,
  982.     "updateTs" timestamp with time zone NOT NULL,
  983.     coach_id integer NOT NULL,
  984.     team_id integer NOT NULL
  985. );
  986.  
  987.  
  988. ALTER TABLE public.t_team_coach_mapping OWNER TO postgres;
  989.  
  990. --
  991. -- Name: t_team_coach_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  992. --
  993.  
  994. CREATE SEQUENCE public.t_team_coach_mapping_id_seq
  995.     AS integer
  996.     START WITH 1
  997.     INCREMENT BY 1
  998.     NO MINVALUE
  999.     NO MAXVALUE
  1000.     CACHE 1;
  1001.  
  1002.  
  1003. ALTER TABLE public.t_team_coach_mapping_id_seq OWNER TO postgres;
  1004.  
  1005. --
  1006. -- Name: t_team_coach_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  1007. --
  1008.  
  1009. ALTER SEQUENCE public.t_team_coach_mapping_id_seq OWNED BY public.t_team_coach_mapping.id;
  1010.  
  1011.  
  1012. --
  1013. -- Name: t_team_leaderboard; Type: TABLE; Schema: public; Owner: postgres
  1014. --
  1015.  
  1016. CREATE TABLE public.t_team_leaderboard (
  1017.     id integer NOT NULL,
  1018.     asofdate date NOT NULL,
  1019.     level character varying(50) NOT NULL,
  1020.     rank integer NOT NULL,
  1021.     score double precision NOT NULL,
  1022.     "insertTs" timestamp with time zone NOT NULL,
  1023.     "updateTs" timestamp with time zone NOT NULL,
  1024.     team_id integer NOT NULL
  1025. );
  1026.  
  1027.  
  1028. ALTER TABLE public.t_team_leaderboard OWNER TO postgres;
  1029.  
  1030. --
  1031. -- Name: t_team_leaderboard_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  1032. --
  1033.  
  1034. CREATE SEQUENCE public.t_team_leaderboard_id_seq
  1035.     AS integer
  1036.     START WITH 1
  1037.     INCREMENT BY 1
  1038.     NO MINVALUE
  1039.     NO MAXVALUE
  1040.     CACHE 1;
  1041.  
  1042.  
  1043. ALTER TABLE public.t_team_leaderboard_id_seq OWNER TO postgres;
  1044.  
  1045. --
  1046. -- Name: t_team_leaderboard_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  1047. --
  1048.  
  1049. ALTER SEQUENCE public.t_team_leaderboard_id_seq OWNED BY public.t_team_leaderboard.id;
  1050.  
  1051.  
  1052. --
  1053. -- Name: t_team_mapping; Type: TABLE; Schema: public; Owner: postgres
  1054. --
  1055.  
  1056. CREATE TABLE public.t_team_mapping (
  1057.     id integer NOT NULL,
  1058.     date date,
  1059.     "insertTs" timestamp with time zone NOT NULL,
  1060.     "updateTs" timestamp with time zone NOT NULL,
  1061.     athlete_id integer NOT NULL,
  1062.     team_id integer NOT NULL
  1063. );
  1064.  
  1065.  
  1066. ALTER TABLE public.t_team_mapping OWNER TO postgres;
  1067.  
  1068. --
  1069. -- Name: t_team_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  1070. --
  1071.  
  1072. CREATE SEQUENCE public.t_team_mapping_id_seq
  1073.     AS integer
  1074.     START WITH 1
  1075.     INCREMENT BY 1
  1076.     NO MINVALUE
  1077.     NO MAXVALUE
  1078.     CACHE 1;
  1079.  
  1080.  
  1081. ALTER TABLE public.t_team_mapping_id_seq OWNER TO postgres;
  1082.  
  1083. --
  1084. -- Name: t_team_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  1085. --
  1086.  
  1087. ALTER SEQUENCE public.t_team_mapping_id_seq OWNED BY public.t_team_mapping.id;
  1088.  
  1089.  
  1090. --
  1091. -- Name: t_team_score; Type: TABLE; Schema: public; Owner: postgres
  1092. --
  1093.  
  1094. CREATE TABLE public.t_team_score (
  1095.     id integer NOT NULL,
  1096.     asofdate date NOT NULL,
  1097.     score double precision NOT NULL,
  1098.     "insertTs" timestamp with time zone NOT NULL,
  1099.     "updateTs" timestamp with time zone NOT NULL,
  1100.     team_id integer NOT NULL
  1101. );
  1102.  
  1103.  
  1104. ALTER TABLE public.t_team_score OWNER TO postgres;
  1105.  
  1106. --
  1107. -- Name: t_team_score_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  1108. --
  1109.  
  1110. CREATE SEQUENCE public.t_team_score_id_seq
  1111.     AS integer
  1112.     START WITH 1
  1113.     INCREMENT BY 1
  1114.     NO MINVALUE
  1115.     NO MAXVALUE
  1116.     CACHE 1;
  1117.  
  1118.  
  1119. ALTER TABLE public.t_team_score_id_seq OWNER TO postgres;
  1120.  
  1121. --
  1122. -- Name: t_team_score_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  1123. --
  1124.  
  1125. ALTER SEQUENCE public.t_team_score_id_seq OWNED BY public.t_team_score.id;
  1126.  
  1127.  
  1128. --
  1129. -- Name: t_team_team_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  1130. --
  1131.  
  1132. CREATE SEQUENCE public.t_team_team_id_seq
  1133.     AS integer
  1134.     START WITH 1
  1135.     INCREMENT BY 1
  1136.     NO MINVALUE
  1137.     NO MAXVALUE
  1138.     CACHE 1;
  1139.  
  1140.  
  1141. ALTER TABLE public.t_team_team_id_seq OWNER TO postgres;
  1142.  
  1143. --
  1144. -- Name: t_team_team_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  1145. --
  1146.  
  1147. ALTER SEQUENCE public.t_team_team_id_seq OWNED BY public.t_team.team_id;
  1148.  
  1149.  
  1150. --
  1151. -- Name: t_user; Type: TABLE; Schema: public; Owner: postgres
  1152. --
  1153.  
  1154. CREATE TABLE public.t_user (
  1155.     password character varying(128) NOT NULL,
  1156.     last_login timestamp with time zone,
  1157.     is_superuser boolean NOT NULL,
  1158.     username character varying(150) NOT NULL,
  1159.     first_name character varying(30) NOT NULL,
  1160.     last_name character varying(150) NOT NULL,
  1161.     email character varying(254) NOT NULL,
  1162.     is_staff boolean NOT NULL,
  1163.     is_active boolean NOT NULL,
  1164.     date_joined timestamp with time zone NOT NULL,
  1165.     user_id integer NOT NULL,
  1166.     role character varying(10) NOT NULL,
  1167.     gender character varying(10),
  1168.     dob date,
  1169.     height_inches integer,
  1170.     weight_lbs integer,
  1171.     city character varying(100),
  1172.     state character varying(50),
  1173.     country character varying(200),
  1174.     "insertTs" timestamp with time zone NOT NULL,
  1175.     "updateTs" timestamp with time zone NOT NULL
  1176. );
  1177.  
  1178.  
  1179. ALTER TABLE public.t_user OWNER TO postgres;
  1180.  
  1181. --
  1182. -- Name: t_user_groups; Type: TABLE; Schema: public; Owner: postgres
  1183. --
  1184.  
  1185. CREATE TABLE public.t_user_groups (
  1186.     id integer NOT NULL,
  1187.     user_id integer NOT NULL,
  1188.     group_id integer NOT NULL
  1189. );
  1190.  
  1191.  
  1192. ALTER TABLE public.t_user_groups OWNER TO postgres;
  1193.  
  1194. --
  1195. -- Name: t_user_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  1196. --
  1197.  
  1198. CREATE SEQUENCE public.t_user_groups_id_seq
  1199.     AS integer
  1200.     START WITH 1
  1201.     INCREMENT BY 1
  1202.     NO MINVALUE
  1203.     NO MAXVALUE
  1204.     CACHE 1;
  1205.  
  1206.  
  1207. ALTER TABLE public.t_user_groups_id_seq OWNER TO postgres;
  1208.  
  1209. --
  1210. -- Name: t_user_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  1211. --
  1212.  
  1213. ALTER SEQUENCE public.t_user_groups_id_seq OWNED BY public.t_user_groups.id;
  1214.  
  1215.  
  1216. --
  1217. -- Name: t_user_user_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  1218. --
  1219.  
  1220. CREATE SEQUENCE public.t_user_user_id_seq
  1221.     AS integer
  1222.     START WITH 1
  1223.     INCREMENT BY 1
  1224.     NO MINVALUE
  1225.     NO MAXVALUE
  1226.     CACHE 1;
  1227.  
  1228.  
  1229. ALTER TABLE public.t_user_user_id_seq OWNER TO postgres;
  1230.  
  1231. --
  1232. -- Name: t_user_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  1233. --
  1234.  
  1235. ALTER SEQUENCE public.t_user_user_id_seq OWNED BY public.t_user.user_id;
  1236.  
  1237.  
  1238. --
  1239. -- Name: t_user_user_permissions; Type: TABLE; Schema: public; Owner: postgres
  1240. --
  1241.  
  1242. CREATE TABLE public.t_user_user_permissions (
  1243.     id integer NOT NULL,
  1244.     user_id integer NOT NULL,
  1245.     permission_id integer NOT NULL
  1246. );
  1247.  
  1248.  
  1249. ALTER TABLE public.t_user_user_permissions OWNER TO postgres;
  1250.  
  1251. --
  1252. -- Name: t_user_user_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  1253. --
  1254.  
  1255. CREATE SEQUENCE public.t_user_user_permissions_id_seq
  1256.     AS integer
  1257.     START WITH 1
  1258.     INCREMENT BY 1
  1259.     NO MINVALUE
  1260.     NO MAXVALUE
  1261.     CACHE 1;
  1262.  
  1263.  
  1264. ALTER TABLE public.t_user_user_permissions_id_seq OWNER TO postgres;
  1265.  
  1266. --
  1267. -- Name: t_user_user_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  1268. --
  1269.  
  1270. ALTER SEQUENCE public.t_user_user_permissions_id_seq OWNED BY public.t_user_user_permissions.id;
  1271.  
  1272.  
  1273. --
  1274. -- Name: vw_athlete_states; Type: VIEW; Schema: public; Owner: postgres
  1275. --
  1276.  
  1277. CREATE VIEW public.vw_athlete_states AS
  1278.  SELECT a.athlete_id,
  1279.     s.team_id,
  1280.     s.name AS team,
  1281.     s.level,
  1282.     s.state
  1283.    FROM (((public.t_athlete a
  1284.      JOIN public.t_team_mapping m ON ((a.athlete_id = m.athlete_id)))
  1285.      JOIN public.t_team t ON ((t.team_id = m.team_id)))
  1286.      JOIN public.t_team s ON ((((t.state)::text = (s.state)::text) AND ((s.level)::text = 'state'::text))))
  1287.   ORDER BY a.athlete_id;
  1288.  
  1289.  
  1290. ALTER TABLE public.vw_athlete_states OWNER TO postgres;
  1291.  
  1292. --
  1293. -- Name: vw_athlete_teams; Type: VIEW; Schema: public; Owner: postgres
  1294. --
  1295.  
  1296. CREATE VIEW public.vw_athlete_teams AS
  1297.  SELECT a.athlete_id,
  1298.     a.last_name,
  1299.     a.first_name,
  1300.     a.gender,
  1301.     a.high_school_class,
  1302.     a.dob,
  1303.     t.team_id,
  1304.     t.name AS team,
  1305.     t.level,
  1306.     t.city,
  1307.     t.state,
  1308.     t.country
  1309.    FROM ((public.t_athlete a
  1310.      JOIN public.t_team_mapping m ON ((a.athlete_id = m.athlete_id)))
  1311.      JOIN public.t_team t ON ((t.team_id = m.team_id)))
  1312.   WHERE ((t.level)::text <> 'state'::text)
  1313.   ORDER BY a.athlete_id;
  1314.  
  1315.  
  1316. ALTER TABLE public.vw_athlete_teams OWNER TO postgres;
  1317.  
  1318. --
  1319. -- Name: auth_group id; Type: DEFAULT; Schema: public; Owner: postgres
  1320. --
  1321.  
  1322. ALTER TABLE ONLY public.auth_group ALTER COLUMN id SET DEFAULT nextval('public.auth_group_id_seq'::regclass);
  1323.  
  1324.  
  1325. --
  1326. -- Name: auth_group_permissions id; Type: DEFAULT; Schema: public; Owner: postgres
  1327. --
  1328.  
  1329. ALTER TABLE ONLY public.auth_group_permissions ALTER COLUMN id SET DEFAULT nextval('public.auth_group_permissions_id_seq'::regclass);
  1330.  
  1331.  
  1332. --
  1333. -- Name: auth_permission id; Type: DEFAULT; Schema: public; Owner: postgres
  1334. --
  1335.  
  1336. ALTER TABLE ONLY public.auth_permission ALTER COLUMN id SET DEFAULT nextval('public.auth_permission_id_seq'::regclass);
  1337.  
  1338.  
  1339. --
  1340. -- Name: django_admin_log id; Type: DEFAULT; Schema: public; Owner: postgres
  1341. --
  1342.  
  1343. ALTER TABLE ONLY public.django_admin_log ALTER COLUMN id SET DEFAULT nextval('public.django_admin_log_id_seq'::regclass);
  1344.  
  1345.  
  1346. --
  1347. -- Name: django_content_type id; Type: DEFAULT; Schema: public; Owner: postgres
  1348. --
  1349.  
  1350. ALTER TABLE ONLY public.django_content_type ALTER COLUMN id SET DEFAULT nextval('public.django_content_type_id_seq'::regclass);
  1351.  
  1352.  
  1353. --
  1354. -- Name: django_migrations id; Type: DEFAULT; Schema: public; Owner: postgres
  1355. --
  1356.  
  1357. ALTER TABLE ONLY public.django_migrations ALTER COLUMN id SET DEFAULT nextval('public.django_migrations_id_seq'::regclass);
  1358.  
  1359.  
  1360. --
  1361. -- Name: django_site id; Type: DEFAULT; Schema: public; Owner: postgres
  1362. --
  1363.  
  1364. ALTER TABLE ONLY public.django_site ALTER COLUMN id SET DEFAULT nextval('public.django_site_id_seq'::regclass);
  1365.  
  1366.  
  1367. --
  1368. -- Name: t_athlete athlete_id; Type: DEFAULT; Schema: public; Owner: postgres
  1369. --
  1370.  
  1371. ALTER TABLE ONLY public.t_athlete ALTER COLUMN athlete_id SET DEFAULT nextval('public.t_athlete_athlete_id_seq'::regclass);
  1372.  
  1373.  
  1374. --
  1375. -- Name: t_athlete_leaderboard id; Type: DEFAULT; Schema: public; Owner: postgres
  1376. --
  1377.  
  1378. ALTER TABLE ONLY public.t_athlete_leaderboard ALTER COLUMN id SET DEFAULT nextval('public.t_athlete_leaderboard_id_seq'::regclass);
  1379.  
  1380.  
  1381. --
  1382. -- Name: t_athlete_rank id; Type: DEFAULT; Schema: public; Owner: postgres
  1383. --
  1384.  
  1385. ALTER TABLE ONLY public.t_athlete_rank ALTER COLUMN id SET DEFAULT nextval('public.t_athlete_rank_id_seq'::regclass);
  1386.  
  1387.  
  1388. --
  1389. -- Name: t_athlete_score id; Type: DEFAULT; Schema: public; Owner: postgres
  1390. --
  1391.  
  1392. ALTER TABLE ONLY public.t_athlete_score ALTER COLUMN id SET DEFAULT nextval('public.t_athlete_score_id_seq'::regclass);
  1393.  
  1394.  
  1395. --
  1396. -- Name: t_coach coach_id; Type: DEFAULT; Schema: public; Owner: postgres
  1397. --
  1398.  
  1399. ALTER TABLE ONLY public.t_coach ALTER COLUMN coach_id SET DEFAULT nextval('public.t_coach_coach_id_seq'::regclass);
  1400.  
  1401.  
  1402. --
  1403. -- Name: t_event id; Type: DEFAULT; Schema: public; Owner: postgres
  1404. --
  1405.  
  1406. ALTER TABLE ONLY public.t_event ALTER COLUMN id SET DEFAULT nextval('public.t_event_id_seq'::regclass);
  1407.  
  1408.  
  1409. --
  1410. -- Name: t_fan fan_id; Type: DEFAULT; Schema: public; Owner: postgres
  1411. --
  1412.  
  1413. ALTER TABLE ONLY public.t_fan ALTER COLUMN fan_id SET DEFAULT nextval('public.t_fan_fan_id_seq'::regclass);
  1414.  
  1415.  
  1416. --
  1417. -- Name: t_meet id; Type: DEFAULT; Schema: public; Owner: postgres
  1418. --
  1419.  
  1420. ALTER TABLE ONLY public.t_meet ALTER COLUMN id SET DEFAULT nextval('public.t_meet_id_seq'::regclass);
  1421.  
  1422.  
  1423. --
  1424. -- Name: t_result id; Type: DEFAULT; Schema: public; Owner: postgres
  1425. --
  1426.  
  1427. ALTER TABLE ONLY public.t_result ALTER COLUMN id SET DEFAULT nextval('public.t_result_id_seq'::regclass);
  1428.  
  1429.  
  1430. --
  1431. -- Name: t_team team_id; Type: DEFAULT; Schema: public; Owner: postgres
  1432. --
  1433.  
  1434. ALTER TABLE ONLY public.t_team ALTER COLUMN team_id SET DEFAULT nextval('public.t_team_team_id_seq'::regclass);
  1435.  
  1436.  
  1437. --
  1438. -- Name: t_team_coach_mapping id; Type: DEFAULT; Schema: public; Owner: postgres
  1439. --
  1440.  
  1441. ALTER TABLE ONLY public.t_team_coach_mapping ALTER COLUMN id SET DEFAULT nextval('public.t_team_coach_mapping_id_seq'::regclass);
  1442.  
  1443.  
  1444. --
  1445. -- Name: t_team_leaderboard id; Type: DEFAULT; Schema: public; Owner: postgres
  1446. --
  1447.  
  1448. ALTER TABLE ONLY public.t_team_leaderboard ALTER COLUMN id SET DEFAULT nextval('public.t_team_leaderboard_id_seq'::regclass);
  1449.  
  1450.  
  1451. --
  1452. -- Name: t_team_mapping id; Type: DEFAULT; Schema: public; Owner: postgres
  1453. --
  1454.  
  1455. ALTER TABLE ONLY public.t_team_mapping ALTER COLUMN id SET DEFAULT nextval('public.t_team_mapping_id_seq'::regclass);
  1456.  
  1457.  
  1458. --
  1459. -- Name: t_team_score id; Type: DEFAULT; Schema: public; Owner: postgres
  1460. --
  1461.  
  1462. ALTER TABLE ONLY public.t_team_score ALTER COLUMN id SET DEFAULT nextval('public.t_team_score_id_seq'::regclass);
  1463.  
  1464.  
  1465. --
  1466. -- Name: t_user user_id; Type: DEFAULT; Schema: public; Owner: postgres
  1467. --
  1468.  
  1469. ALTER TABLE ONLY public.t_user ALTER COLUMN user_id SET DEFAULT nextval('public.t_user_user_id_seq'::regclass);
  1470.  
  1471.  
  1472. --
  1473. -- Name: t_user_groups id; Type: DEFAULT; Schema: public; Owner: postgres
  1474. --
  1475.  
  1476. ALTER TABLE ONLY public.t_user_groups ALTER COLUMN id SET DEFAULT nextval('public.t_user_groups_id_seq'::regclass);
  1477.  
  1478.  
  1479. --
  1480. -- Name: t_user_user_permissions id; Type: DEFAULT; Schema: public; Owner: postgres
  1481. --
  1482.  
  1483. ALTER TABLE ONLY public.t_user_user_permissions ALTER COLUMN id SET DEFAULT nextval('public.t_user_user_permissions_id_seq'::regclass);
  1484.  
  1485.  
  1486. --
  1487. -- Name: auth_group auth_group_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
  1488. --
  1489.  
  1490. ALTER TABLE ONLY public.auth_group
  1491.     ADD CONSTRAINT auth_group_name_key UNIQUE (name);
  1492.  
  1493.  
  1494. --
  1495. -- Name: auth_group_permissions auth_group_permissions_group_id_permission_id_0cd325b0_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1496. --
  1497.  
  1498. ALTER TABLE ONLY public.auth_group_permissions
  1499.     ADD CONSTRAINT auth_group_permissions_group_id_permission_id_0cd325b0_uniq UNIQUE (group_id, permission_id);
  1500.  
  1501.  
  1502. --
  1503. -- Name: auth_group_permissions auth_group_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1504. --
  1505.  
  1506. ALTER TABLE ONLY public.auth_group_permissions
  1507.     ADD CONSTRAINT auth_group_permissions_pkey PRIMARY KEY (id);
  1508.  
  1509.  
  1510. --
  1511. -- Name: auth_group auth_group_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1512. --
  1513.  
  1514. ALTER TABLE ONLY public.auth_group
  1515.     ADD CONSTRAINT auth_group_pkey PRIMARY KEY (id);
  1516.  
  1517.  
  1518. --
  1519. -- Name: auth_permission auth_permission_content_type_id_codename_01ab375a_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1520. --
  1521.  
  1522. ALTER TABLE ONLY public.auth_permission
  1523.     ADD CONSTRAINT auth_permission_content_type_id_codename_01ab375a_uniq UNIQUE (content_type_id, codename);
  1524.  
  1525.  
  1526. --
  1527. -- Name: auth_permission auth_permission_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1528. --
  1529.  
  1530. ALTER TABLE ONLY public.auth_permission
  1531.     ADD CONSTRAINT auth_permission_pkey PRIMARY KEY (id);
  1532.  
  1533.  
  1534. --
  1535. -- Name: authtoken_token authtoken_token_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1536. --
  1537.  
  1538. ALTER TABLE ONLY public.authtoken_token
  1539.     ADD CONSTRAINT authtoken_token_pkey PRIMARY KEY (key);
  1540.  
  1541.  
  1542. --
  1543. -- Name: authtoken_token authtoken_token_user_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres
  1544. --
  1545.  
  1546. ALTER TABLE ONLY public.authtoken_token
  1547.     ADD CONSTRAINT authtoken_token_user_id_key UNIQUE (user_id);
  1548.  
  1549.  
  1550. --
  1551. -- Name: django_admin_log django_admin_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1552. --
  1553.  
  1554. ALTER TABLE ONLY public.django_admin_log
  1555.     ADD CONSTRAINT django_admin_log_pkey PRIMARY KEY (id);
  1556.  
  1557.  
  1558. --
  1559. -- Name: django_content_type django_content_type_app_label_model_76bd3d3b_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1560. --
  1561.  
  1562. ALTER TABLE ONLY public.django_content_type
  1563.     ADD CONSTRAINT django_content_type_app_label_model_76bd3d3b_uniq UNIQUE (app_label, model);
  1564.  
  1565.  
  1566. --
  1567. -- Name: django_content_type django_content_type_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1568. --
  1569.  
  1570. ALTER TABLE ONLY public.django_content_type
  1571.     ADD CONSTRAINT django_content_type_pkey PRIMARY KEY (id);
  1572.  
  1573.  
  1574. --
  1575. -- Name: django_migrations django_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1576. --
  1577.  
  1578. ALTER TABLE ONLY public.django_migrations
  1579.     ADD CONSTRAINT django_migrations_pkey PRIMARY KEY (id);
  1580.  
  1581.  
  1582. --
  1583. -- Name: django_session django_session_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1584. --
  1585.  
  1586. ALTER TABLE ONLY public.django_session
  1587.     ADD CONSTRAINT django_session_pkey PRIMARY KEY (session_key);
  1588.  
  1589.  
  1590. --
  1591. -- Name: django_site django_site_domain_a2e37b91_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1592. --
  1593.  
  1594. ALTER TABLE ONLY public.django_site
  1595.     ADD CONSTRAINT django_site_domain_a2e37b91_uniq UNIQUE (domain);
  1596.  
  1597.  
  1598. --
  1599. -- Name: django_site django_site_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1600. --
  1601.  
  1602. ALTER TABLE ONLY public.django_site
  1603.     ADD CONSTRAINT django_site_pkey PRIMARY KEY (id);
  1604.  
  1605.  
  1606. --
  1607. -- Name: t_athlete_leaderboard t_athlete_leaderboard_asofdate_level_athlete_id_30ac532a_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1608. --
  1609.  
  1610. ALTER TABLE ONLY public.t_athlete_leaderboard
  1611.     ADD CONSTRAINT t_athlete_leaderboard_asofdate_level_athlete_id_30ac532a_uniq UNIQUE (asofdate, level, athlete_id);
  1612.  
  1613.  
  1614. --
  1615. -- Name: t_athlete_leaderboard t_athlete_leaderboard_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1616. --
  1617.  
  1618. ALTER TABLE ONLY public.t_athlete_leaderboard
  1619.     ADD CONSTRAINT t_athlete_leaderboard_pkey PRIMARY KEY (id);
  1620.  
  1621.  
  1622. --
  1623. -- Name: t_athlete t_athlete_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1624. --
  1625.  
  1626. ALTER TABLE ONLY public.t_athlete
  1627.     ADD CONSTRAINT t_athlete_pkey PRIMARY KEY (athlete_id);
  1628.  
  1629.  
  1630. --
  1631. -- Name: t_athlete_rank t_athlete_rank_asofdate_event_id_level__1a9f0ebf_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1632. --
  1633.  
  1634. ALTER TABLE ONLY public.t_athlete_rank
  1635.     ADD CONSTRAINT t_athlete_rank_asofdate_event_id_level__1a9f0ebf_uniq UNIQUE (asofdate, event_id, level, gender, athlete_id);
  1636.  
  1637.  
  1638. --
  1639. -- Name: t_athlete_rank t_athlete_rank_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1640. --
  1641.  
  1642. ALTER TABLE ONLY public.t_athlete_rank
  1643.     ADD CONSTRAINT t_athlete_rank_pkey PRIMARY KEY (id);
  1644.  
  1645.  
  1646. --
  1647. -- Name: t_athlete_score t_athlete_score_asofdate_athlete_id_beba1d9d_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1648. --
  1649.  
  1650. ALTER TABLE ONLY public.t_athlete_score
  1651.     ADD CONSTRAINT t_athlete_score_asofdate_athlete_id_beba1d9d_uniq UNIQUE (asofdate, athlete_id);
  1652.  
  1653.  
  1654. --
  1655. -- Name: t_athlete_score t_athlete_score_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1656. --
  1657.  
  1658. ALTER TABLE ONLY public.t_athlete_score
  1659.     ADD CONSTRAINT t_athlete_score_pkey PRIMARY KEY (id);
  1660.  
  1661.  
  1662. --
  1663. -- Name: t_coach t_coach_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1664. --
  1665.  
  1666. ALTER TABLE ONLY public.t_coach
  1667.     ADD CONSTRAINT t_coach_pkey PRIMARY KEY (coach_id);
  1668.  
  1669.  
  1670. --
  1671. -- Name: t_event t_event_name_event_type_04c7cb64_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1672. --
  1673.  
  1674. ALTER TABLE ONLY public.t_event
  1675.     ADD CONSTRAINT t_event_name_event_type_04c7cb64_uniq UNIQUE (name, event_type);
  1676.  
  1677.  
  1678. --
  1679. -- Name: t_event t_event_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1680. --
  1681.  
  1682. ALTER TABLE ONLY public.t_event
  1683.     ADD CONSTRAINT t_event_pkey PRIMARY KEY (id);
  1684.  
  1685.  
  1686. --
  1687. -- Name: t_fan t_fan_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1688. --
  1689.  
  1690. ALTER TABLE ONLY public.t_fan
  1691.     ADD CONSTRAINT t_fan_pkey PRIMARY KEY (fan_id);
  1692.  
  1693.  
  1694. --
  1695. -- Name: t_meet t_meet_name_date_fca1a922_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1696. --
  1697.  
  1698. ALTER TABLE ONLY public.t_meet
  1699.     ADD CONSTRAINT t_meet_name_date_fca1a922_uniq UNIQUE (name, date);
  1700.  
  1701.  
  1702. --
  1703. -- Name: t_meet t_meet_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1704. --
  1705.  
  1706. ALTER TABLE ONLY public.t_meet
  1707.     ADD CONSTRAINT t_meet_pkey PRIMARY KEY (id);
  1708.  
  1709.  
  1710. --
  1711. -- Name: t_result t_result_meet_id_event_id_athlete_id_1e231e5d_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1712. --
  1713.  
  1714. ALTER TABLE ONLY public.t_result
  1715.     ADD CONSTRAINT t_result_meet_id_event_id_athlete_id_1e231e5d_uniq UNIQUE (meet_id, event_id, athlete_id);
  1716.  
  1717.  
  1718. --
  1719. -- Name: t_result t_result_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1720. --
  1721.  
  1722. ALTER TABLE ONLY public.t_result
  1723.     ADD CONSTRAINT t_result_pkey PRIMARY KEY (id);
  1724.  
  1725.  
  1726. --
  1727. -- Name: t_team_coach_mapping t_team_coach_mapping_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1728. --
  1729.  
  1730. ALTER TABLE ONLY public.t_team_coach_mapping
  1731.     ADD CONSTRAINT t_team_coach_mapping_pkey PRIMARY KEY (id);
  1732.  
  1733.  
  1734. --
  1735. -- Name: t_team_coach_mapping t_team_coach_mapping_team_id_coach_id_date_0e5d97ef_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1736. --
  1737.  
  1738. ALTER TABLE ONLY public.t_team_coach_mapping
  1739.     ADD CONSTRAINT t_team_coach_mapping_team_id_coach_id_date_0e5d97ef_uniq UNIQUE (team_id, coach_id, date);
  1740.  
  1741.  
  1742. --
  1743. -- Name: t_team_leaderboard t_team_leaderboard_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1744. --
  1745.  
  1746. ALTER TABLE ONLY public.t_team_leaderboard
  1747.     ADD CONSTRAINT t_team_leaderboard_pkey PRIMARY KEY (id);
  1748.  
  1749.  
  1750. --
  1751. -- Name: t_team_leaderboard t_team_leaderboard_team_id_asofdate_level_8b7b5876_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1752. --
  1753.  
  1754. ALTER TABLE ONLY public.t_team_leaderboard
  1755.     ADD CONSTRAINT t_team_leaderboard_team_id_asofdate_level_8b7b5876_uniq UNIQUE (team_id, asofdate, level);
  1756.  
  1757.  
  1758. --
  1759. -- Name: t_team_mapping t_team_mapping_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1760. --
  1761.  
  1762. ALTER TABLE ONLY public.t_team_mapping
  1763.     ADD CONSTRAINT t_team_mapping_pkey PRIMARY KEY (id);
  1764.  
  1765.  
  1766. --
  1767. -- Name: t_team_mapping t_team_mapping_team_id_athlete_id_date_7207c7dd_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1768. --
  1769.  
  1770. ALTER TABLE ONLY public.t_team_mapping
  1771.     ADD CONSTRAINT t_team_mapping_team_id_athlete_id_date_7207c7dd_uniq UNIQUE (team_id, athlete_id, date);
  1772.  
  1773.  
  1774. --
  1775. -- Name: t_team t_team_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1776. --
  1777.  
  1778. ALTER TABLE ONLY public.t_team
  1779.     ADD CONSTRAINT t_team_pkey PRIMARY KEY (team_id);
  1780.  
  1781.  
  1782. --
  1783. -- Name: t_team_score t_team_score_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1784. --
  1785.  
  1786. ALTER TABLE ONLY public.t_team_score
  1787.     ADD CONSTRAINT t_team_score_pkey PRIMARY KEY (id);
  1788.  
  1789.  
  1790. --
  1791. -- Name: t_team_score t_team_score_team_id_asofdate_8823f31b_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1792. --
  1793.  
  1794. ALTER TABLE ONLY public.t_team_score
  1795.     ADD CONSTRAINT t_team_score_team_id_asofdate_8823f31b_uniq UNIQUE (team_id, asofdate);
  1796.  
  1797.  
  1798. --
  1799. -- Name: t_user_groups t_user_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1800. --
  1801.  
  1802. ALTER TABLE ONLY public.t_user_groups
  1803.     ADD CONSTRAINT t_user_groups_pkey PRIMARY KEY (id);
  1804.  
  1805.  
  1806. --
  1807. -- Name: t_user_groups t_user_groups_user_id_group_id_c723baf9_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1808. --
  1809.  
  1810. ALTER TABLE ONLY public.t_user_groups
  1811.     ADD CONSTRAINT t_user_groups_user_id_group_id_c723baf9_uniq UNIQUE (user_id, group_id);
  1812.  
  1813.  
  1814. --
  1815. -- Name: t_user t_user_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1816. --
  1817.  
  1818. ALTER TABLE ONLY public.t_user
  1819.     ADD CONSTRAINT t_user_pkey PRIMARY KEY (user_id);
  1820.  
  1821.  
  1822. --
  1823. -- Name: t_user_user_permissions t_user_user_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  1824. --
  1825.  
  1826. ALTER TABLE ONLY public.t_user_user_permissions
  1827.     ADD CONSTRAINT t_user_user_permissions_pkey PRIMARY KEY (id);
  1828.  
  1829.  
  1830. --
  1831. -- Name: t_user_user_permissions t_user_user_permissions_user_id_permission_id_1605a84a_uniq; Type: CONSTRAINT; Schema: public; Owner: postgres
  1832. --
  1833.  
  1834. ALTER TABLE ONLY public.t_user_user_permissions
  1835.     ADD CONSTRAINT t_user_user_permissions_user_id_permission_id_1605a84a_uniq UNIQUE (user_id, permission_id);
  1836.  
  1837.  
  1838. --
  1839. -- Name: t_user t_user_username_key; Type: CONSTRAINT; Schema: public; Owner: postgres
  1840. --
  1841.  
  1842. ALTER TABLE ONLY public.t_user
  1843.     ADD CONSTRAINT t_user_username_key UNIQUE (username);
  1844.  
  1845.  
  1846. --
  1847. -- Name: auth_group_name_a6ea08ec_like; Type: INDEX; Schema: public; Owner: postgres
  1848. --
  1849.  
  1850. CREATE INDEX auth_group_name_a6ea08ec_like ON public.auth_group USING btree (name varchar_pattern_ops);
  1851.  
  1852.  
  1853. --
  1854. -- Name: auth_group_permissions_group_id_b120cbf9; Type: INDEX; Schema: public; Owner: postgres
  1855. --
  1856.  
  1857. CREATE INDEX auth_group_permissions_group_id_b120cbf9 ON public.auth_group_permissions USING btree (group_id);
  1858.  
  1859.  
  1860. --
  1861. -- Name: auth_group_permissions_permission_id_84c5c92e; Type: INDEX; Schema: public; Owner: postgres
  1862. --
  1863.  
  1864. CREATE INDEX auth_group_permissions_permission_id_84c5c92e ON public.auth_group_permissions USING btree (permission_id);
  1865.  
  1866.  
  1867. --
  1868. -- Name: auth_permission_content_type_id_2f476e4b; Type: INDEX; Schema: public; Owner: postgres
  1869. --
  1870.  
  1871. CREATE INDEX auth_permission_content_type_id_2f476e4b ON public.auth_permission USING btree (content_type_id);
  1872.  
  1873.  
  1874. --
  1875. -- Name: authtoken_token_key_10f0b77e_like; Type: INDEX; Schema: public; Owner: postgres
  1876. --
  1877.  
  1878. CREATE INDEX authtoken_token_key_10f0b77e_like ON public.authtoken_token USING btree (key varchar_pattern_ops);
  1879.  
  1880.  
  1881. --
  1882. -- Name: django_admin_log_content_type_id_c4bce8eb; Type: INDEX; Schema: public; Owner: postgres
  1883. --
  1884.  
  1885. CREATE INDEX django_admin_log_content_type_id_c4bce8eb ON public.django_admin_log USING btree (content_type_id);
  1886.  
  1887.  
  1888. --
  1889. -- Name: django_admin_log_user_id_c564eba6; Type: INDEX; Schema: public; Owner: postgres
  1890. --
  1891.  
  1892. CREATE INDEX django_admin_log_user_id_c564eba6 ON public.django_admin_log USING btree (user_id);
  1893.  
  1894.  
  1895. --
  1896. -- Name: django_session_expire_date_a5c62663; Type: INDEX; Schema: public; Owner: postgres
  1897. --
  1898.  
  1899. CREATE INDEX django_session_expire_date_a5c62663 ON public.django_session USING btree (expire_date);
  1900.  
  1901.  
  1902. --
  1903. -- Name: django_session_session_key_c0390e0f_like; Type: INDEX; Schema: public; Owner: postgres
  1904. --
  1905.  
  1906. CREATE INDEX django_session_session_key_c0390e0f_like ON public.django_session USING btree (session_key varchar_pattern_ops);
  1907.  
  1908.  
  1909. --
  1910. -- Name: django_site_domain_a2e37b91_like; Type: INDEX; Schema: public; Owner: postgres
  1911. --
  1912.  
  1913. CREATE INDEX django_site_domain_a2e37b91_like ON public.django_site USING btree (domain varchar_pattern_ops);
  1914.  
  1915.  
  1916. --
  1917. -- Name: t_athlete_l_level_f47234_idx; Type: INDEX; Schema: public; Owner: postgres
  1918. --
  1919.  
  1920. CREATE INDEX t_athlete_l_level_f47234_idx ON public.t_athlete_leaderboard USING btree (level, athlete_id);
  1921.  
  1922.  
  1923. --
  1924. -- Name: t_athlete_leaderboard_athlete_id_10a3b6dd; Type: INDEX; Schema: public; Owner: postgres
  1925. --
  1926.  
  1927. CREATE INDEX t_athlete_leaderboard_athlete_id_10a3b6dd ON public.t_athlete_leaderboard USING btree (athlete_id);
  1928.  
  1929.  
  1930. --
  1931. -- Name: t_athlete_r_athlete_78e395_idx; Type: INDEX; Schema: public; Owner: postgres
  1932. --
  1933.  
  1934. CREATE INDEX t_athlete_r_athlete_78e395_idx ON public.t_athlete_rank USING btree (athlete_id, asofdate);
  1935.  
  1936.  
  1937. --
  1938. -- Name: t_athlete_rank_athlete_id_0b901a4d; Type: INDEX; Schema: public; Owner: postgres
  1939. --
  1940.  
  1941. CREATE INDEX t_athlete_rank_athlete_id_0b901a4d ON public.t_athlete_rank USING btree (athlete_id);
  1942.  
  1943.  
  1944. --
  1945. -- Name: t_athlete_rank_event_id_56d3ab2a; Type: INDEX; Schema: public; Owner: postgres
  1946. --
  1947.  
  1948. CREATE INDEX t_athlete_rank_event_id_56d3ab2a ON public.t_athlete_rank USING btree (event_id);
  1949.  
  1950.  
  1951. --
  1952. -- Name: t_athlete_rank_result_id_abc7ca58; Type: INDEX; Schema: public; Owner: postgres
  1953. --
  1954.  
  1955. CREATE INDEX t_athlete_rank_result_id_abc7ca58 ON public.t_athlete_rank USING btree (result_id);
  1956.  
  1957.  
  1958. --
  1959. -- Name: t_athlete_score_athlete_id_0fa68c4d; Type: INDEX; Schema: public; Owner: postgres
  1960. --
  1961.  
  1962. CREATE INDEX t_athlete_score_athlete_id_0fa68c4d ON public.t_athlete_score USING btree (athlete_id);
  1963.  
  1964.  
  1965. --
  1966. -- Name: t_athlete_user_id_cb56d3b6; Type: INDEX; Schema: public; Owner: postgres
  1967. --
  1968.  
  1969. CREATE INDEX t_athlete_user_id_cb56d3b6 ON public.t_athlete USING btree (user_id);
  1970.  
  1971.  
  1972. --
  1973. -- Name: t_coach_user_id_532670ca; Type: INDEX; Schema: public; Owner: postgres
  1974. --
  1975.  
  1976. CREATE INDEX t_coach_user_id_532670ca ON public.t_coach USING btree (user_id);
  1977.  
  1978.  
  1979. --
  1980. -- Name: t_fan_user_id_3c8f7eb9; Type: INDEX; Schema: public; Owner: postgres
  1981. --
  1982.  
  1983. CREATE INDEX t_fan_user_id_3c8f7eb9 ON public.t_fan USING btree (user_id);
  1984.  
  1985.  
  1986. --
  1987. -- Name: t_result_athlete_127651_idx; Type: INDEX; Schema: public; Owner: postgres
  1988. --
  1989.  
  1990. CREATE INDEX t_result_athlete_127651_idx ON public.t_result USING btree (athlete_id);
  1991.  
  1992.  
  1993. --
  1994. -- Name: t_result_athlete_id_55d8c956; Type: INDEX; Schema: public; Owner: postgres
  1995. --
  1996.  
  1997. CREATE INDEX t_result_athlete_id_55d8c956 ON public.t_result USING btree (athlete_id);
  1998.  
  1999.  
  2000. --
  2001. -- Name: t_result_event_i_9ebcec_idx; Type: INDEX; Schema: public; Owner: postgres
  2002. --
  2003.  
  2004. CREATE INDEX t_result_event_i_9ebcec_idx ON public.t_result USING btree (event_id);
  2005.  
  2006.  
  2007. --
  2008. -- Name: t_result_event_id_9b25d41d; Type: INDEX; Schema: public; Owner: postgres
  2009. --
  2010.  
  2011. CREATE INDEX t_result_event_id_9b25d41d ON public.t_result USING btree (event_id);
  2012.  
  2013.  
  2014. --
  2015. -- Name: t_result_meet_id_3c9db0b7; Type: INDEX; Schema: public; Owner: postgres
  2016. --
  2017.  
  2018. CREATE INDEX t_result_meet_id_3c9db0b7 ON public.t_result USING btree (meet_id);
  2019.  
  2020.  
  2021. --
  2022. -- Name: t_team_coach_mapping_coach_id_9e6bdc2c; Type: INDEX; Schema: public; Owner: postgres
  2023. --
  2024.  
  2025. CREATE INDEX t_team_coach_mapping_coach_id_9e6bdc2c ON public.t_team_coach_mapping USING btree (coach_id);
  2026.  
  2027.  
  2028. --
  2029. -- Name: t_team_coach_mapping_team_id_32afe19b; Type: INDEX; Schema: public; Owner: postgres
  2030. --
  2031.  
  2032. CREATE INDEX t_team_coach_mapping_team_id_32afe19b ON public.t_team_coach_mapping USING btree (team_id);
  2033.  
  2034.  
  2035. --
  2036. -- Name: t_team_lead_level_5eac9c_idx; Type: INDEX; Schema: public; Owner: postgres
  2037. --
  2038.  
  2039. CREATE INDEX t_team_lead_level_5eac9c_idx ON public.t_team_leaderboard USING btree (level, team_id);
  2040.  
  2041.  
  2042. --
  2043. -- Name: t_team_leaderboard_team_id_20238bcd; Type: INDEX; Schema: public; Owner: postgres
  2044. --
  2045.  
  2046. CREATE INDEX t_team_leaderboard_team_id_20238bcd ON public.t_team_leaderboard USING btree (team_id);
  2047.  
  2048.  
  2049. --
  2050. -- Name: t_team_mapping_athlete_id_49b6b2bb; Type: INDEX; Schema: public; Owner: postgres
  2051. --
  2052.  
  2053. CREATE INDEX t_team_mapping_athlete_id_49b6b2bb ON public.t_team_mapping USING btree (athlete_id);
  2054.  
  2055.  
  2056. --
  2057. -- Name: t_team_mapping_team_id_cfca1792; Type: INDEX; Schema: public; Owner: postgres
  2058. --
  2059.  
  2060. CREATE INDEX t_team_mapping_team_id_cfca1792 ON public.t_team_mapping USING btree (team_id);
  2061.  
  2062.  
  2063. --
  2064. -- Name: t_team_score_team_id_c87c6316; Type: INDEX; Schema: public; Owner: postgres
  2065. --
  2066.  
  2067. CREATE INDEX t_team_score_team_id_c87c6316 ON public.t_team_score USING btree (team_id);
  2068.  
  2069.  
  2070. --
  2071. -- Name: t_user_groups_group_id_9bc1d710; Type: INDEX; Schema: public; Owner: postgres
  2072. --
  2073.  
  2074. CREATE INDEX t_user_groups_group_id_9bc1d710 ON public.t_user_groups USING btree (group_id);
  2075.  
  2076.  
  2077. --
  2078. -- Name: t_user_groups_user_id_f297e4a8; Type: INDEX; Schema: public; Owner: postgres
  2079. --
  2080.  
  2081. CREATE INDEX t_user_groups_user_id_f297e4a8 ON public.t_user_groups USING btree (user_id);
  2082.  
  2083.  
  2084. --
  2085. -- Name: t_user_user_permissions_permission_id_2fd0b058; Type: INDEX; Schema: public; Owner: postgres
  2086. --
  2087.  
  2088. CREATE INDEX t_user_user_permissions_permission_id_2fd0b058 ON public.t_user_user_permissions USING btree (permission_id);
  2089.  
  2090.  
  2091. --
  2092. -- Name: t_user_user_permissions_user_id_542a10c4; Type: INDEX; Schema: public; Owner: postgres
  2093. --
  2094.  
  2095. CREATE INDEX t_user_user_permissions_user_id_542a10c4 ON public.t_user_user_permissions USING btree (user_id);
  2096.  
  2097.  
  2098. --
  2099. -- Name: t_user_username_0920a77a_like; Type: INDEX; Schema: public; Owner: postgres
  2100. --
  2101.  
  2102. CREATE INDEX t_user_username_0920a77a_like ON public.t_user USING btree (username varchar_pattern_ops);
  2103.  
  2104.  
  2105. --
  2106. -- Name: auth_group_permissions auth_group_permissio_permission_id_84c5c92e_fk_auth_perm; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2107. --
  2108.  
  2109. ALTER TABLE ONLY public.auth_group_permissions
  2110.     ADD CONSTRAINT auth_group_permissio_permission_id_84c5c92e_fk_auth_perm FOREIGN KEY (permission_id) REFERENCES public.auth_permission(id) DEFERRABLE INITIALLY DEFERRED;
  2111.  
  2112.  
  2113. --
  2114. -- Name: auth_group_permissions auth_group_permissions_group_id_b120cbf9_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2115. --
  2116.  
  2117. ALTER TABLE ONLY public.auth_group_permissions
  2118.     ADD CONSTRAINT auth_group_permissions_group_id_b120cbf9_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES public.auth_group(id) DEFERRABLE INITIALLY DEFERRED;
  2119.  
  2120.  
  2121. --
  2122. -- Name: auth_permission auth_permission_content_type_id_2f476e4b_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2123. --
  2124.  
  2125. ALTER TABLE ONLY public.auth_permission
  2126.     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;
  2127.  
  2128.  
  2129. --
  2130. -- Name: authtoken_token authtoken_token_user_id_35299eff_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2131. --
  2132.  
  2133. ALTER TABLE ONLY public.authtoken_token
  2134.     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;
  2135.  
  2136.  
  2137. --
  2138. -- Name: django_admin_log django_admin_log_content_type_id_c4bce8eb_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2139. --
  2140.  
  2141. ALTER TABLE ONLY public.django_admin_log
  2142.     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;
  2143.  
  2144.  
  2145. --
  2146. -- Name: django_admin_log django_admin_log_user_id_c564eba6_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2147. --
  2148.  
  2149. ALTER TABLE ONLY public.django_admin_log
  2150.     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;
  2151.  
  2152.  
  2153. --
  2154. -- Name: t_athlete_leaderboard t_athlete_leaderboar_athlete_id_10a3b6dd_fk_t_athlete; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2155. --
  2156.  
  2157. ALTER TABLE ONLY public.t_athlete_leaderboard
  2158.     ADD CONSTRAINT t_athlete_leaderboar_athlete_id_10a3b6dd_fk_t_athlete FOREIGN KEY (athlete_id) REFERENCES public.t_athlete(athlete_id) DEFERRABLE INITIALLY DEFERRED;
  2159.  
  2160.  
  2161. --
  2162. -- Name: t_athlete_rank t_athlete_rank_athlete_id_0b901a4d_fk_t_athlete_athlete_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2163. --
  2164.  
  2165. ALTER TABLE ONLY public.t_athlete_rank
  2166.     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;
  2167.  
  2168.  
  2169. --
  2170. -- Name: t_athlete_rank t_athlete_rank_event_id_56d3ab2a_fk_t_event_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2171. --
  2172.  
  2173. ALTER TABLE ONLY public.t_athlete_rank
  2174.     ADD CONSTRAINT t_athlete_rank_event_id_56d3ab2a_fk_t_event_id FOREIGN KEY (event_id) REFERENCES public.t_event(id) DEFERRABLE INITIALLY DEFERRED;
  2175.  
  2176.  
  2177. --
  2178. -- Name: t_athlete_rank t_athlete_rank_result_id_abc7ca58_fk_t_result_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2179. --
  2180.  
  2181. ALTER TABLE ONLY public.t_athlete_rank
  2182.     ADD CONSTRAINT t_athlete_rank_result_id_abc7ca58_fk_t_result_id FOREIGN KEY (result_id) REFERENCES public.t_result(id) DEFERRABLE INITIALLY DEFERRED;
  2183.  
  2184.  
  2185. --
  2186. -- Name: t_athlete_score t_athlete_score_athlete_id_0fa68c4d_fk_t_athlete_athlete_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2187. --
  2188.  
  2189. ALTER TABLE ONLY public.t_athlete_score
  2190.     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;
  2191.  
  2192.  
  2193. --
  2194. -- Name: t_athlete t_athlete_user_id_cb56d3b6_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2195. --
  2196.  
  2197. ALTER TABLE ONLY public.t_athlete
  2198.     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;
  2199.  
  2200.  
  2201. --
  2202. -- Name: t_coach t_coach_user_id_532670ca_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2203. --
  2204.  
  2205. ALTER TABLE ONLY public.t_coach
  2206.     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;
  2207.  
  2208.  
  2209. --
  2210. -- Name: t_fan t_fan_user_id_3c8f7eb9_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2211. --
  2212.  
  2213. ALTER TABLE ONLY public.t_fan
  2214.     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;
  2215.  
  2216.  
  2217. --
  2218. -- Name: t_result t_result_athlete_id_55d8c956_fk_t_athlete_athlete_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2219. --
  2220.  
  2221. ALTER TABLE ONLY public.t_result
  2222.     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;
  2223.  
  2224.  
  2225. --
  2226. -- Name: t_result t_result_event_id_9b25d41d_fk_t_event_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2227. --
  2228.  
  2229. ALTER TABLE ONLY public.t_result
  2230.     ADD CONSTRAINT t_result_event_id_9b25d41d_fk_t_event_id FOREIGN KEY (event_id) REFERENCES public.t_event(id) DEFERRABLE INITIALLY DEFERRED;
  2231.  
  2232.  
  2233. --
  2234. -- Name: t_result t_result_meet_id_3c9db0b7_fk_t_meet_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2235. --
  2236.  
  2237. ALTER TABLE ONLY public.t_result
  2238.     ADD CONSTRAINT t_result_meet_id_3c9db0b7_fk_t_meet_id FOREIGN KEY (meet_id) REFERENCES public.t_meet(id) DEFERRABLE INITIALLY DEFERRED;
  2239.  
  2240.  
  2241. --
  2242. -- Name: t_team_coach_mapping t_team_coach_mapping_coach_id_9e6bdc2c_fk_t_coach_coach_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2243. --
  2244.  
  2245. ALTER TABLE ONLY public.t_team_coach_mapping
  2246.     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;
  2247.  
  2248.  
  2249. --
  2250. -- Name: t_team_coach_mapping t_team_coach_mapping_team_id_32afe19b_fk_t_team_team_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2251. --
  2252.  
  2253. ALTER TABLE ONLY public.t_team_coach_mapping
  2254.     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;
  2255.  
  2256.  
  2257. --
  2258. -- Name: t_team_leaderboard t_team_leaderboard_team_id_20238bcd_fk_t_team_team_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2259. --
  2260.  
  2261. ALTER TABLE ONLY public.t_team_leaderboard
  2262.     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;
  2263.  
  2264.  
  2265. --
  2266. -- Name: t_team_mapping t_team_mapping_athlete_id_49b6b2bb_fk_t_athlete_athlete_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2267. --
  2268.  
  2269. ALTER TABLE ONLY public.t_team_mapping
  2270.     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;
  2271.  
  2272.  
  2273. --
  2274. -- Name: t_team_mapping t_team_mapping_team_id_cfca1792_fk_t_team_team_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2275. --
  2276.  
  2277. ALTER TABLE ONLY public.t_team_mapping
  2278.     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;
  2279.  
  2280.  
  2281. --
  2282. -- Name: t_team_score t_team_score_team_id_c87c6316_fk_t_team_team_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2283. --
  2284.  
  2285. ALTER TABLE ONLY public.t_team_score
  2286.     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;
  2287.  
  2288.  
  2289. --
  2290. -- Name: t_user_groups t_user_groups_group_id_9bc1d710_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2291. --
  2292.  
  2293. ALTER TABLE ONLY public.t_user_groups
  2294.     ADD CONSTRAINT t_user_groups_group_id_9bc1d710_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES public.auth_group(id) DEFERRABLE INITIALLY DEFERRED;
  2295.  
  2296.  
  2297. --
  2298. -- Name: t_user_groups t_user_groups_user_id_f297e4a8_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2299. --
  2300.  
  2301. ALTER TABLE ONLY public.t_user_groups
  2302.     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;
  2303.  
  2304.  
  2305. --
  2306. -- Name: t_user_user_permissions t_user_user_permissi_permission_id_2fd0b058_fk_auth_perm; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2307. --
  2308.  
  2309. ALTER TABLE ONLY public.t_user_user_permissions
  2310.     ADD CONSTRAINT t_user_user_permissi_permission_id_2fd0b058_fk_auth_perm FOREIGN KEY (permission_id) REFERENCES public.auth_permission(id) DEFERRABLE INITIALLY DEFERRED;
  2311.  
  2312.  
  2313. --
  2314. -- Name: t_user_user_permissions t_user_user_permissions_user_id_542a10c4_fk_t_user_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  2315. --
  2316.  
  2317. ALTER TABLE ONLY public.t_user_user_permissions
  2318.     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;
  2319.  
  2320.  
  2321. --
  2322. -- PostgreSQL database dump complete
  2323. --
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top