Created
July 29, 2018 17:03
-
-
Save qaisjp/b641e088d9b4128d5d198bc7e6307fd5 to your computer and use it in GitHub Desktop.
quickfox schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- PostgreSQL database dump | |
-- | |
-- Dumped from database version 9.6.5 | |
-- Dumped by pg_dump version 10.4 | |
-- Started on 2018-07-29 18:00:35 BST | |
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 client_min_messages = warning; | |
SET row_security = off; | |
-- | |
-- TOC entry 1 (class 3079 OID 12427) | |
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: | |
-- | |
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; | |
-- | |
-- TOC entry 2202 (class 0 OID 0) | |
-- Dependencies: 1 | |
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: | |
-- | |
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; | |
SET default_tablespace = ''; | |
SET default_with_oids = false; | |
-- | |
-- TOC entry 185 (class 1259 OID 17104) | |
-- Name: destinations; Type: TABLE; Schema: public; Owner: postgres | |
-- | |
CREATE TABLE public.destinations ( | |
id integer NOT NULL, | |
trip integer NOT NULL, | |
name text NOT NULL, | |
url text NOT NULL, | |
price numeric NOT NULL, | |
stops integer DEFAULT 0 | |
); | |
ALTER TABLE public.destinations OWNER TO postgres; | |
-- | |
-- TOC entry 186 (class 1259 OID 17111) | |
-- Name: destinations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres | |
-- | |
CREATE SEQUENCE public.destinations_id_seq | |
START WITH 1 | |
INCREMENT BY 1 | |
NO MINVALUE | |
NO MAXVALUE | |
CACHE 1; | |
ALTER TABLE public.destinations_id_seq OWNER TO postgres; | |
-- | |
-- TOC entry 2203 (class 0 OID 0) | |
-- Dependencies: 186 | |
-- Name: destinations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres | |
-- | |
ALTER SEQUENCE public.destinations_id_seq OWNED BY public.destinations.id; | |
-- | |
-- TOC entry 187 (class 1259 OID 17113) | |
-- Name: trips; Type: TABLE; Schema: public; Owner: postgres | |
-- | |
CREATE TABLE public.trips ( | |
id integer NOT NULL, | |
owner integer NOT NULL, | |
name text NOT NULL, | |
archived boolean DEFAULT false NOT NULL, | |
created_at timestamp without time zone DEFAULT now() NOT NULL | |
); | |
ALTER TABLE public.trips OWNER TO postgres; | |
-- | |
-- TOC entry 188 (class 1259 OID 17121) | |
-- Name: trips_guests; Type: TABLE; Schema: public; Owner: postgres | |
-- | |
CREATE TABLE public.trips_guests ( | |
trip integer NOT NULL, | |
guest integer NOT NULL | |
); | |
ALTER TABLE public.trips_guests OWNER TO postgres; | |
-- | |
-- TOC entry 189 (class 1259 OID 17124) | |
-- Name: trips_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres | |
-- | |
CREATE SEQUENCE public.trips_id_seq | |
START WITH 1 | |
INCREMENT BY 1 | |
NO MINVALUE | |
NO MAXVALUE | |
CACHE 1; | |
ALTER TABLE public.trips_id_seq OWNER TO postgres; | |
-- | |
-- TOC entry 2204 (class 0 OID 0) | |
-- Dependencies: 189 | |
-- Name: trips_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres | |
-- | |
ALTER SEQUENCE public.trips_id_seq OWNED BY public.trips.id; | |
-- | |
-- TOC entry 190 (class 1259 OID 17126) | |
-- Name: users; Type: TABLE; Schema: public; Owner: postgres | |
-- | |
CREATE TABLE public.users ( | |
id integer NOT NULL, | |
email text NOT NULL, | |
password character(60) NOT NULL, | |
name text NOT NULL | |
); | |
ALTER TABLE public.users OWNER TO postgres; | |
-- | |
-- TOC entry 191 (class 1259 OID 17132) | |
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres | |
-- | |
CREATE SEQUENCE public.users_id_seq | |
START WITH 1 | |
INCREMENT BY 1 | |
NO MINVALUE | |
NO MAXVALUE | |
CACHE 1; | |
ALTER TABLE public.users_id_seq OWNER TO postgres; | |
-- | |
-- TOC entry 2205 (class 0 OID 0) | |
-- Dependencies: 191 | |
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres | |
-- | |
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; | |
-- | |
-- TOC entry 2059 (class 2604 OID 17135) | |
-- Name: destinations id; Type: DEFAULT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.destinations ALTER COLUMN id SET DEFAULT nextval('public.destinations_id_seq'::regclass); | |
-- | |
-- TOC entry 2062 (class 2604 OID 17136) | |
-- Name: trips id; Type: DEFAULT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.trips ALTER COLUMN id SET DEFAULT nextval('public.trips_id_seq'::regclass); | |
-- | |
-- TOC entry 2063 (class 2604 OID 17137) | |
-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); | |
-- | |
-- TOC entry 2065 (class 2606 OID 17149) | |
-- Name: destinations dests_id_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.destinations | |
ADD CONSTRAINT dests_id_pkey PRIMARY KEY (id); | |
-- | |
-- TOC entry 2069 (class 2606 OID 17151) | |
-- Name: trips_guests key_trips_guests; Type: CONSTRAINT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.trips_guests | |
ADD CONSTRAINT key_trips_guests PRIMARY KEY (trip, guest); | |
-- | |
-- TOC entry 2067 (class 2606 OID 17153) | |
-- Name: trips trips_id_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.trips | |
ADD CONSTRAINT trips_id_pkey PRIMARY KEY (id); | |
-- | |
-- TOC entry 2071 (class 2606 OID 17155) | |
-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.users | |
ADD CONSTRAINT users_email_key UNIQUE (email); | |
-- | |
-- TOC entry 2073 (class 2606 OID 17157) | |
-- Name: users users_id_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.users | |
ADD CONSTRAINT users_id_pkey PRIMARY KEY (id); | |
-- | |
-- TOC entry 2074 (class 2606 OID 17174) | |
-- Name: destinations dests_trip_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.destinations | |
ADD CONSTRAINT dests_trip_fkey FOREIGN KEY (trip) REFERENCES public.trips(id); | |
-- | |
-- TOC entry 2076 (class 2606 OID 17179) | |
-- Name: trips_guests trips_guests_guest_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.trips_guests | |
ADD CONSTRAINT trips_guests_guest_fkey FOREIGN KEY (guest) REFERENCES public.users(id); | |
-- | |
-- TOC entry 2077 (class 2606 OID 17184) | |
-- Name: trips_guests trips_guests_trip_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.trips_guests | |
ADD CONSTRAINT trips_guests_trip_fkey FOREIGN KEY (trip) REFERENCES public.trips(id); | |
-- | |
-- TOC entry 2075 (class 2606 OID 17189) | |
-- Name: trips trips_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
-- | |
ALTER TABLE ONLY public.trips | |
ADD CONSTRAINT trips_user_fkey FOREIGN KEY (owner) REFERENCES public.users(id); | |
-- Completed on 2018-07-29 18:00:39 BST | |
-- | |
-- PostgreSQL database dump complete | |
-- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment