--
-- PostgreSQL database dump
--

-- Dumped from database version 12.0
-- Dumped by pg_dump version 12.4

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: category; Type: TYPE; Schema: public; Owner: postgres
--

CREATE TYPE public.category AS ENUM (
    'Edit',
    'Effect',
    'Generator'
);


ALTER TYPE public.category OWNER TO postgres;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: og_script_versions; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.og_script_versions (
    id integer NOT NULL,
    script_id integer,
    code text NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    description character varying(280) NOT NULL,
    category public.category NOT NULL,
    name character varying(140) NOT NULL
);


ALTER TABLE public.og_script_versions OWNER TO postgres;

--
-- Name: og_script_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.og_script_versions_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.og_script_versions_id_seq OWNER TO postgres;

--
-- Name: og_script_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.og_script_versions_id_seq OWNED BY public.og_script_versions.id;


--
-- Name: scripts; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.og_scripts (
    id integer NOT NULL,
    creator_id integer NOT NULL
);


ALTER TABLE public.og_scripts OWNER TO postgres;

--
-- Name: scripts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.og_scripts_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.og_scripts_id_seq OWNER TO postgres;

--
-- Name: scripts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.og_scripts_id_seq OWNED BY public.og_scripts.id;


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

CREATE TABLE public.og_users (
    id integer NOT NULL,
    github_id character varying(14) NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


ALTER TABLE public.og_users OWNER TO postgres;

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

CREATE SEQUENCE public.og_users_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.og_users_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.og_users_id_seq OWNED BY public.og_users.id;


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

ALTER TABLE ONLY public.og_script_versions ALTER COLUMN id SET DEFAULT nextval('public.og_script_versions_id_seq'::regclass);


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

ALTER TABLE ONLY public.og_scripts ALTER COLUMN id SET DEFAULT nextval('public.og_scripts_id_seq'::regclass);


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

ALTER TABLE ONLY public.og_users ALTER COLUMN id SET DEFAULT nextval('public.og_users_id_seq'::regclass);


--
-- Name: og_script_versions og_script_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.og_script_versions
    ADD CONSTRAINT og_script_versions_pkey PRIMARY KEY (id);


--
-- Name: scripts scripts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.og_scripts
    ADD CONSTRAINT scripts_pkey PRIMARY KEY (id);


--
-- Name: users users_github_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.og_users
    ADD CONSTRAINT users_github_id_key UNIQUE (github_id);


--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.og_users
    ADD CONSTRAINT users_pkey PRIMARY KEY (id);


--
-- Name: og_script_versions script_versions_script_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.og_script_versions
    ADD CONSTRAINT script_versions_script_id FOREIGN KEY (script_id) REFERENCES public.og_scripts(id) ON UPDATE CASCADE ON DELETE RESTRICT;


--
-- Name: scripts scripts_creator_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.og_scripts
    ADD CONSTRAINT scripts_creator_id FOREIGN KEY (creator_id) REFERENCES public.og_users(id) ON UPDATE CASCADE ON DELETE RESTRICT;


--
-- PostgreSQL database dump complete
--

