--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;


--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';


SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: categories; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE categories (
    id integer NOT NULL,
    name text NOT NULL,
    slug character varying(255) NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE categories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE categories_id_seq OWNED BY categories.id;


--
-- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE comments (
    id integer NOT NULL,
    page_id integer NOT NULL,
    name text NOT NULL,
    email text NOT NULL,
    website text NOT NULL,
    body text NOT NULL,
    approved_date timestamp without time zone,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE comments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE comments_id_seq OWNED BY comments.id;


--
-- Name: contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE contacts (
    id integer NOT NULL,
    name text NOT NULL,
    email text NOT NULL,
    tel text DEFAULT ''::text NOT NULL,
    address1 text DEFAULT ''::text NOT NULL,
    address2 text DEFAULT ''::text NOT NULL,
    address3 text DEFAULT ''::text NOT NULL,
    city text DEFAULT ''::text NOT NULL,
    county text DEFAULT ''::text NOT NULL,
    postcode text DEFAULT ''::text NOT NULL,
    comments text DEFAULT ''::text NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: contacts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE contacts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE contacts_id_seq OWNED BY contacts.id;


--
-- Name: contents; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE contents (
    id integer NOT NULL,
    page_id integer NOT NULL,
    summary text DEFAULT ''::text NOT NULL,
    summary_image character varying(255),
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: contents_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE contents_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE contents_id_seq OWNED BY contents.id;


--
-- Name: download_contents; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE download_contents (
    id integer NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    title text DEFAULT ''::text NOT NULL,
    description text DEFAULT ''::text NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    download_id integer,
    show_in_content boolean DEFAULT true NOT NULL,
    show_in_sidebar boolean DEFAULT false NOT NULL,
    content_id integer NOT NULL
);


--
-- Name: download_contents_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE download_contents_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: download_contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE download_contents_id_seq OWNED BY download_contents.id;


--
-- Name: downloads; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE downloads (
    id integer NOT NULL,
    file text NOT NULL,
    default_title text DEFAULT ''::text NOT NULL,
    default_description text DEFAULT ''::text NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: downloads_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE downloads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: downloads_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE downloads_id_seq OWNED BY downloads.id;


--
-- Name: external_media_contents; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE external_media_contents (
    id integer NOT NULL,
    content_id integer NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    media_url text DEFAULT ''::text NOT NULL,
    description text DEFAULT ''::text NOT NULL,
    copyright text DEFAULT ''::text NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: external_media_contents_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE external_media_contents_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: external_media_contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE external_media_contents_id_seq OWNED BY external_media_contents.id;


--
-- Name: header_images; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE header_images (
    id integer NOT NULL,
    content_id integer NOT NULL,
    alt_text character varying(255) DEFAULT ''::character varying NOT NULL,
    caption character varying(2048) DEFAULT ''::character varying NOT NULL,
    image_desktop character varying(255),
    image_tablet character varying(255),
    image_mobile character varying(255),
    link_url text DEFAULT ''::text NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    title character varying(1024) DEFAULT ''::character varying NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: header_images_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE header_images_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: header_images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE header_images_id_seq OWNED BY header_images.id;


--
-- Name: highlights; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE highlights (
    id integer NOT NULL,
    live boolean DEFAULT false NOT NULL,
    title text NOT NULL,
    description text DEFAULT ''::text NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    target_page_id integer,
    url text DEFAULT ''::text NOT NULL,
    image text NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: highlights_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE highlights_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: highlights_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE highlights_id_seq OWNED BY highlights.id;


--
-- Name: image_contents; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE image_contents (
    id integer NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    image text NOT NULL,
    alt_text character varying(255) DEFAULT ''::character varying NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    content_id integer NOT NULL,
    caption text DEFAULT ''::text NOT NULL,
    url text DEFAULT ''::text NOT NULL
);


--
-- Name: image_contents_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE image_contents_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: image_contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE image_contents_id_seq OWNED BY image_contents.id;


--
-- Name: link_contents; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE link_contents (
    id integer NOT NULL,
    target_page_id integer,
    "position" integer DEFAULT 0 NOT NULL,
    url text NOT NULL,
    title text NOT NULL,
    show_in_content boolean DEFAULT true NOT NULL,
    show_in_sidebar boolean DEFAULT false NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    content_id integer NOT NULL
);


--
-- Name: link_contents_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE link_contents_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: link_contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE link_contents_id_seq OWNED BY link_contents.id;


--
-- Name: newsletter_signups; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE newsletter_signups (
    id integer NOT NULL,
    email text NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: newsletter_signups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE newsletter_signups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: newsletter_signups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE newsletter_signups_id_seq OWNED BY newsletter_signups.id;


--
-- Name: page_categories; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE page_categories (
    page_id integer NOT NULL,
    category_id integer NOT NULL
);


--
-- Name: page_hierarchies; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE page_hierarchies (
    ancestor_id integer NOT NULL,
    descendant_id integer NOT NULL,
    generations integer NOT NULL
);


--
-- Name: page_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE page_tags (
    page_id integer NOT NULL,
    tag_id integer NOT NULL
);


--
-- Name: pages; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE pages (
    id integer NOT NULL,
    style character varying(50) NOT NULL,
    title character varying(255) NOT NULL,
    slug character varying(255) NOT NULL,
    live boolean DEFAULT false NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    deleteable boolean DEFAULT true NOT NULL,
    show_in_menu boolean DEFAULT true NOT NULL,
    published_at timestamp without time zone,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    parent_id integer,
    menu_title text DEFAULT ''::text NOT NULL,
    meta_description text DEFAULT ''::text NOT NULL,
    event_date timestamp without time zone,
    to_be_confirmed boolean DEFAULT false NOT NULL,
    event_location text DEFAULT ''::text NOT NULL,
    event_date_description text DEFAULT ''::text NOT NULL,
    event_date_finish timestamp without time zone,
    html_title text DEFAULT ''::text NOT NULL,
    meta_robots character varying(100) DEFAULT ''::character varying NOT NULL
);


--
-- Name: pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE pages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE pages_id_seq OWNED BY pages.id;


--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE schema_migrations (
    version character varying(255) NOT NULL
);


--
-- Name: summary_contents; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE summary_contents (
    id integer NOT NULL,
    content_id integer NOT NULL,
    title character varying(255) DEFAULT ''::character varying NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: summary_contents_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE summary_contents_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: summary_contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE summary_contents_id_seq OWNED BY summary_contents.id;


--
-- Name: summary_pages; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE summary_pages (
    id integer NOT NULL,
    style integer NOT NULL,
    show_page_id integer NOT NULL,
    summary_content_id integer NOT NULL,
    "position" integer DEFAULT 0 NOT NULL
);


--
-- Name: summary_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE summary_pages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: summary_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE summary_pages_id_seq OWNED BY summary_pages.id;


--
-- Name: tags; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE tags (
    id integer NOT NULL,
    name text NOT NULL,
    slug character varying(255) NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


--
-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE tags_id_seq OWNED BY tags.id;


--
-- Name: text_contents; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE text_contents (
    id integer NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    body text NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    content_id integer NOT NULL
);


--
-- Name: text_contents_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE text_contents_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: text_contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE text_contents_id_seq OWNED BY text_contents.id;


--
-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE users (
    id integer NOT NULL,
    email character varying(255) NOT NULL,
    title character varying(10) DEFAULT ''::character varying NOT NULL,
    first_name character varying(20) DEFAULT ''::character varying NOT NULL,
    surname character varying(20) DEFAULT ''::character varying NOT NULL,
    telephone character varying(50) DEFAULT ''::character varying NOT NULL,
    address1 character varying(100) DEFAULT ''::character varying NOT NULL,
    address2 character varying(100) DEFAULT ''::character varying NOT NULL,
    address3 character varying(100) DEFAULT ''::character varying NOT NULL,
    post_code character varying(10) DEFAULT ''::character varying NOT NULL,
    role character varying(5) NOT NULL,
    crypted_password character varying(255) NOT NULL,
    password_salt character varying(255) NOT NULL,
    persistence_token character varying(255) NOT NULL,
    single_access_token character varying(255) NOT NULL,
    perishable_token character varying(255) NOT NULL,
    login_count integer DEFAULT 0 NOT NULL,
    failed_login_count integer DEFAULT 0 NOT NULL,
    last_request_at timestamp without time zone,
    current_login_at timestamp without time zone,
    last_login_at timestamp without time zone,
    current_login_ip character varying(15),
    last_login_ip character varying(15),
    confirmed_at timestamp without time zone,
    opted_in boolean DEFAULT false NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    blog_author boolean DEFAULT false NOT NULL
);


--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE users_id_seq OWNED BY users.id;


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY categories ALTER COLUMN id SET DEFAULT nextval('categories_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY contacts ALTER COLUMN id SET DEFAULT nextval('contacts_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY contents ALTER COLUMN id SET DEFAULT nextval('contents_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY download_contents ALTER COLUMN id SET DEFAULT nextval('download_contents_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY downloads ALTER COLUMN id SET DEFAULT nextval('downloads_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY external_media_contents ALTER COLUMN id SET DEFAULT nextval('external_media_contents_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY header_images ALTER COLUMN id SET DEFAULT nextval('header_images_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY highlights ALTER COLUMN id SET DEFAULT nextval('highlights_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY image_contents ALTER COLUMN id SET DEFAULT nextval('image_contents_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY link_contents ALTER COLUMN id SET DEFAULT nextval('link_contents_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY newsletter_signups ALTER COLUMN id SET DEFAULT nextval('newsletter_signups_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY pages ALTER COLUMN id SET DEFAULT nextval('pages_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY summary_contents ALTER COLUMN id SET DEFAULT nextval('summary_contents_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY summary_pages ALTER COLUMN id SET DEFAULT nextval('summary_pages_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY tags ALTER COLUMN id SET DEFAULT nextval('tags_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY text_contents ALTER COLUMN id SET DEFAULT nextval('text_contents_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);


--
-- Name: categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY categories
    ADD CONSTRAINT categories_pkey PRIMARY KEY (id);


--
-- Name: categories_slug_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY categories
    ADD CONSTRAINT categories_slug_key UNIQUE (slug);


--
-- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY comments
    ADD CONSTRAINT comments_pkey PRIMARY KEY (id);


--
-- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY contacts
    ADD CONSTRAINT contacts_pkey PRIMARY KEY (id);


--
-- Name: contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY contents
    ADD CONSTRAINT contents_pkey PRIMARY KEY (id);


--
-- Name: download_contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY download_contents
    ADD CONSTRAINT download_contents_pkey PRIMARY KEY (id);


--
-- Name: downloads_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY downloads
    ADD CONSTRAINT downloads_pkey PRIMARY KEY (id);


--
-- Name: external_media_contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY external_media_contents
    ADD CONSTRAINT external_media_contents_pkey PRIMARY KEY (id);


--
-- Name: header_images_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY header_images
    ADD CONSTRAINT header_images_pkey PRIMARY KEY (id);


--
-- Name: highlights_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY highlights
    ADD CONSTRAINT highlights_pkey PRIMARY KEY (id);


--
-- Name: image_contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY image_contents
    ADD CONSTRAINT image_contents_pkey PRIMARY KEY (id);


--
-- Name: link_contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY link_contents
    ADD CONSTRAINT link_contents_pkey PRIMARY KEY (id);


--
-- Name: newsletter_signups_email_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY newsletter_signups
    ADD CONSTRAINT newsletter_signups_email_key UNIQUE (email);


--
-- Name: newsletter_signups_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY newsletter_signups
    ADD CONSTRAINT newsletter_signups_pkey PRIMARY KEY (id);


--
-- Name: page_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY page_categories
    ADD CONSTRAINT page_categories_pkey PRIMARY KEY (page_id, category_id);


--
-- Name: page_hierarchies_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY page_hierarchies
    ADD CONSTRAINT page_hierarchies_pkey PRIMARY KEY (ancestor_id, descendant_id);


--
-- Name: page_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY page_tags
    ADD CONSTRAINT page_tags_pkey PRIMARY KEY (page_id, tag_id);


--
-- Name: pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY pages
    ADD CONSTRAINT pages_pkey PRIMARY KEY (id);


--
-- Name: pages_slug_parent_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY pages
    ADD CONSTRAINT pages_slug_parent_id_key UNIQUE (slug, parent_id);


--
-- Name: summary_contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY summary_contents
    ADD CONSTRAINT summary_contents_pkey PRIMARY KEY (id);


--
-- Name: summary_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY summary_pages
    ADD CONSTRAINT summary_pages_pkey PRIMARY KEY (id);


--
-- Name: tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY tags
    ADD CONSTRAINT tags_pkey PRIMARY KEY (id);


--
-- Name: tags_slug_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY tags
    ADD CONSTRAINT tags_slug_key UNIQUE (slug);


--
-- Name: text_contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY text_contents
    ADD CONSTRAINT text_contents_pkey PRIMARY KEY (id);


--
-- Name: users_email_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY users
    ADD CONSTRAINT users_email_key UNIQUE (email);


--
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY users
    ADD CONSTRAINT users_pkey PRIMARY KEY (id);


--
-- Name: page_hierarchies_descendant_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX page_hierarchies_descendant_id_idx ON page_hierarchies USING btree (descendant_id);


--
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);


--
-- Name: comments_page_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY comments
    ADD CONSTRAINT comments_page_id_fkey FOREIGN KEY (page_id) REFERENCES pages(id);


--
-- Name: contents_page_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY contents
    ADD CONSTRAINT contents_page_id_fkey FOREIGN KEY (page_id) REFERENCES pages(id);


--
-- Name: download_contents_content_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY download_contents
    ADD CONSTRAINT download_contents_content_id_fkey FOREIGN KEY (content_id) REFERENCES contents(id);


--
-- Name: download_contents_download_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY download_contents
    ADD CONSTRAINT download_contents_download_id_fkey FOREIGN KEY (download_id) REFERENCES downloads(id);


--
-- Name: external_media_contents_content_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY external_media_contents
    ADD CONSTRAINT external_media_contents_content_id_fkey FOREIGN KEY (content_id) REFERENCES contents(id);


--
-- Name: header_images_content_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY header_images
    ADD CONSTRAINT header_images_content_id_fkey FOREIGN KEY (content_id) REFERENCES contents(id);


--
-- Name: highlights_target_page_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY highlights
    ADD CONSTRAINT highlights_target_page_id_fkey FOREIGN KEY (target_page_id) REFERENCES pages(id);


--
-- Name: image_contents_content_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY image_contents
    ADD CONSTRAINT image_contents_content_id_fkey FOREIGN KEY (content_id) REFERENCES contents(id);


--
-- Name: link_contents_content_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY link_contents
    ADD CONSTRAINT link_contents_content_id_fkey FOREIGN KEY (content_id) REFERENCES contents(id);


--
-- Name: link_contents_target_page_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY link_contents
    ADD CONSTRAINT link_contents_target_page_id_fkey FOREIGN KEY (target_page_id) REFERENCES pages(id);


--
-- Name: page_categories_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY page_categories
    ADD CONSTRAINT page_categories_category_id_fkey FOREIGN KEY (category_id) REFERENCES categories(id);


--
-- Name: page_categories_page_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY page_categories
    ADD CONSTRAINT page_categories_page_id_fkey FOREIGN KEY (page_id) REFERENCES pages(id);


--
-- Name: page_hierarchies_ancestor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY page_hierarchies
    ADD CONSTRAINT page_hierarchies_ancestor_id_fkey FOREIGN KEY (ancestor_id) REFERENCES pages(id);


--
-- Name: page_hierarchies_descendant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY page_hierarchies
    ADD CONSTRAINT page_hierarchies_descendant_id_fkey FOREIGN KEY (descendant_id) REFERENCES pages(id);


--
-- Name: page_tags_page_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY page_tags
    ADD CONSTRAINT page_tags_page_id_fkey FOREIGN KEY (page_id) REFERENCES pages(id);


--
-- Name: page_tags_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY page_tags
    ADD CONSTRAINT page_tags_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES tags(id);


--
-- Name: pages_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY pages
    ADD CONSTRAINT pages_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES pages(id);


--
-- Name: summary_contents_content_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY summary_contents
    ADD CONSTRAINT summary_contents_content_id_fkey FOREIGN KEY (content_id) REFERENCES contents(id);


--
-- Name: summary_pages_show_page_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY summary_pages
    ADD CONSTRAINT summary_pages_show_page_id_fkey FOREIGN KEY (show_page_id) REFERENCES pages(id);


--
-- Name: summary_pages_summary_content_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY summary_pages
    ADD CONSTRAINT summary_pages_summary_content_id_fkey FOREIGN KEY (summary_content_id) REFERENCES summary_contents(id);


--
-- Name: text_contents_content_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY text_contents
    ADD CONSTRAINT text_contents_content_id_fkey FOREIGN KEY (content_id) REFERENCES contents(id);


--
-- PostgreSQL database dump complete
--

SET search_path TO "$user",public;

INSERT INTO schema_migrations (version) VALUES ('20121015131221');

INSERT INTO schema_migrations (version) VALUES ('20121026145508');

INSERT INTO schema_migrations (version) VALUES ('20121109163204');

INSERT INTO schema_migrations (version) VALUES ('20121121113513');

INSERT INTO schema_migrations (version) VALUES ('20121122103916');

INSERT INTO schema_migrations (version) VALUES ('20121128104051');

INSERT INTO schema_migrations (version) VALUES ('20121128141717');

INSERT INTO schema_migrations (version) VALUES ('20121129115859');

INSERT INTO schema_migrations (version) VALUES ('20121217094238');

INSERT INTO schema_migrations (version) VALUES ('20130409082915');

INSERT INTO schema_migrations (version) VALUES ('20130501131742');

INSERT INTO schema_migrations (version) VALUES ('20130510152441');

INSERT INTO schema_migrations (version) VALUES ('20130528083420');

INSERT INTO schema_migrations (version) VALUES ('20130723161704');

INSERT INTO schema_migrations (version) VALUES ('20130724150209');

INSERT INTO schema_migrations (version) VALUES ('20130726152655');

INSERT INTO schema_migrations (version) VALUES ('20130910084945');

INSERT INTO schema_migrations (version) VALUES ('20130918105318');

INSERT INTO schema_migrations (version) VALUES ('20130918140711');

INSERT INTO schema_migrations (version) VALUES ('20130919100435');

INSERT INTO schema_migrations (version) VALUES ('20131112160612');

INSERT INTO schema_migrations (version) VALUES ('20140417132121');

INSERT INTO schema_migrations (version) VALUES ('20140506152326');

INSERT INTO schema_migrations (version) VALUES ('20141027112058');

INSERT INTO schema_migrations (version) VALUES ('20150921103148');

INSERT INTO schema_migrations (version) VALUES ('20150922075954');

INSERT INTO schema_migrations (version) VALUES ('20150925080245');

INSERT INTO schema_migrations (version) VALUES ('20150928090831');

INSERT INTO schema_migrations (version) VALUES ('20151012090033');

INSERT INTO schema_migrations (version) VALUES ('20151102110154');

INSERT INTO schema_migrations (version) VALUES ('20151102135912');

