--
--


--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA public IS 'Standard public schema';





--
-- Name: answer; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE answer (
    id serial NOT NULL,
    answer text,
    creation_date timestamp without time zone,
    question_id integer,
    creator_id integer
);


ALTER TABLE public.answer OWNER TO postgres;

--
-- Name: answer_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('answer', 'id'), 1, true);


--
-- Name: catwalk_state_table; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE catwalk_state_table (
    id serial NOT NULL,
    state bytea
);


ALTER TABLE public.catwalk_state_table OWNER TO postgres;

--
-- Name: catwalk_state_table_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('catwalk_state_table', 'id'), 1, false);


--
-- Name: groups; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE groups (
    id serial NOT NULL,
    group_name character varying(16) NOT NULL,
    display_name character varying(255),
    created timestamp without time zone
);


ALTER TABLE public.groups OWNER TO postgres;

--
-- Name: groups_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('groups', 'id'), 1, true);


--
-- Name: issue; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE issue (
    id serial NOT NULL,
    issue text,
    impact integer,
    closed boolean,
    project_id integer,
    creator_id integer,
    creation_date timestamp without time zone
);


ALTER TABLE public.issue OWNER TO postgres;

--
-- Name: issue_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('issue', 'id'), 1, true);


--
-- Name: note; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE note (
    id serial NOT NULL,
    note text,
    creation_date timestamp without time zone,
    last_edit_date timestamp without time zone,
    project_id integer,
    creator_id integer
);


ALTER TABLE public.note OWNER TO postgres;

--
-- Name: note_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('note', 'id'), 1, true);


--
-- Name: permission; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE permission (
    id serial NOT NULL,
    permission_name character varying(16) NOT NULL,
    description character varying(255)
);


ALTER TABLE public.permission OWNER TO postgres;

--
-- Name: permission_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('permission', 'id'), 1, false);


--
-- Name: person; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE person (
    id serial NOT NULL,
    display_name text NOT NULL,
    user_id text NOT NULL,
    "password" text,
    email_address text
);


ALTER TABLE public.person OWNER TO postgres;

--
-- Name: person_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('person', 'id'), 2, true);


--
-- Name: project; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE project (
    id serial NOT NULL,
    name text NOT NULL,
    description text,
    archived boolean,
    status integer,
    parent_project_id integer,
    contact_id integer
);


ALTER TABLE public.project OWNER TO postgres;

--
-- Name: project_file; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE project_file (
    id serial NOT NULL,
    filename text,
    systemfilename text,
    creation_date timestamp without time zone,
    project_id integer,
    creator_id integer
);


ALTER TABLE public.project_file OWNER TO postgres;

--
-- Name: project_file_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('project_file', 'id'), 1, false);


--
-- Name: project_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('project', 'id'), 1, true);


--
-- Name: question; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE question (
    id serial NOT NULL,
    question text,
    creation_date timestamp without time zone,
    project_id integer,
    creator_id integer
);


ALTER TABLE public.question OWNER TO postgres;

--
-- Name: question_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('question', 'id'), 1, true);


--
-- Name: risk; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE risk (
    id serial NOT NULL,
    chance integer,
    impact integer,
    description text,
    closed boolean,
    creation_date timestamp without time zone,
    project_id integer,
    creator_id integer
);


ALTER TABLE public.risk OWNER TO postgres;

--
-- Name: risk_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('risk', 'id'), 1, true);


--
-- Name: tg_group_permission; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tg_group_permission (
    group_name integer NOT NULL,
    permission_name integer NOT NULL
);


ALTER TABLE public.tg_group_permission OWNER TO postgres;

--
-- Name: tg_user_group; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tg_user_group (
    group_name integer NOT NULL,
    user_name integer NOT NULL
);


ALTER TABLE public.tg_user_group OWNER TO postgres;

--
-- Name: tg_visit; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tg_visit (
    id serial NOT NULL,
    visit_key character varying(40) NOT NULL,
    created timestamp without time zone,
    expiry timestamp without time zone
);


ALTER TABLE public.tg_visit OWNER TO postgres;

--
-- Name: tg_visit_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('tg_visit', 'id'), 1, true);


--
-- Name: tg_visit_identity; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tg_visit_identity (
    id serial NOT NULL,
    user_id integer,
    visit_key character varying(40) NOT NULL
);


ALTER TABLE public.tg_visit_identity OWNER TO postgres;

--
-- Name: tg_visit_identity_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('tg_visit_identity', 'id'), 1, true);


--
-- Data for Name: groups; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY groups (id, group_name, display_name, created) FROM stdin;
1	admin	Administrators	2006-03-06 14:11:00
\.


--
-- Data for Name: person; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY person (id, display_name, user_id, "password", email_address) FROM stdin;
1	Administrator	admin	21232f297a57a5a743894a0e4a801fc3	admin@admin.com
\.


--
-- Data for Name: tg_user_group; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY tg_user_group (group_name, user_name) FROM stdin;
1	1
\.


--
-- Name: answer_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY answer
    ADD CONSTRAINT answer_pkey PRIMARY KEY (id);


ALTER INDEX public.answer_pkey OWNER TO postgres;

--
-- Name: catwalk_state_table_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY catwalk_state_table
    ADD CONSTRAINT catwalk_state_table_pkey PRIMARY KEY (id);


ALTER INDEX public.catwalk_state_table_pkey OWNER TO postgres;

--
-- Name: groups_group_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY groups
    ADD CONSTRAINT groups_group_id_key UNIQUE (group_name);


ALTER INDEX public.groups_group_id_key OWNER TO postgres;

--
-- Name: groups_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY groups
    ADD CONSTRAINT groups_pkey PRIMARY KEY (id);


ALTER INDEX public.groups_pkey OWNER TO postgres;

--
-- Name: issue_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY issue
    ADD CONSTRAINT issue_pkey PRIMARY KEY (id);


ALTER INDEX public.issue_pkey OWNER TO postgres;

--
-- Name: note_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY note
    ADD CONSTRAINT note_pkey PRIMARY KEY (id);


ALTER INDEX public.note_pkey OWNER TO postgres;

--
-- Name: permission_permission_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY permission
    ADD CONSTRAINT permission_permission_id_key UNIQUE (permission_name);


ALTER INDEX public.permission_permission_id_key OWNER TO postgres;

--
-- Name: permission_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY permission
    ADD CONSTRAINT permission_pkey PRIMARY KEY (id);


ALTER INDEX public.permission_pkey OWNER TO postgres;

--
-- Name: person_display_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY person
    ADD CONSTRAINT person_display_name_key UNIQUE (display_name);


ALTER INDEX public.person_display_name_key OWNER TO postgres;

--
-- Name: person_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY person
    ADD CONSTRAINT person_pkey PRIMARY KEY (id);


ALTER INDEX public.person_pkey OWNER TO postgres;

--
-- Name: person_user_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY person
    ADD CONSTRAINT person_user_id_key UNIQUE (user_id);


ALTER INDEX public.person_user_id_key OWNER TO postgres;

--
-- Name: project_file_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY project_file
    ADD CONSTRAINT project_file_pkey PRIMARY KEY (id);


ALTER INDEX public.project_file_pkey OWNER TO postgres;

--
-- Name: project_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY project
    ADD CONSTRAINT project_name_key UNIQUE (name);


ALTER INDEX public.project_name_key OWNER TO postgres;

--
-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY project
    ADD CONSTRAINT project_pkey PRIMARY KEY (id);


ALTER INDEX public.project_pkey OWNER TO postgres;

--
-- Name: question_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY question
    ADD CONSTRAINT question_pkey PRIMARY KEY (id);


ALTER INDEX public.question_pkey OWNER TO postgres;

--
-- Name: risk_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY risk
    ADD CONSTRAINT risk_pkey PRIMARY KEY (id);


ALTER INDEX public.risk_pkey OWNER TO postgres;

--
-- Name: tg_visit_identity_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tg_visit_identity
    ADD CONSTRAINT tg_visit_identity_pkey PRIMARY KEY (id);


ALTER INDEX public.tg_visit_identity_pkey OWNER TO postgres;

--
-- Name: tg_visit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tg_visit
    ADD CONSTRAINT tg_visit_pkey PRIMARY KEY (id);


ALTER INDEX public.tg_visit_pkey OWNER TO postgres;

--
-- Name: tg_visit_visit_key_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tg_visit
    ADD CONSTRAINT tg_visit_visit_key_key UNIQUE (visit_key);


ALTER INDEX public.tg_visit_visit_key_key OWNER TO postgres;

--
-- Name: contact_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY project
    ADD CONSTRAINT contact_id_exists FOREIGN KEY (contact_id) REFERENCES person(id);


--
-- Name: creator_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY answer
    ADD CONSTRAINT creator_id_exists FOREIGN KEY (creator_id) REFERENCES person(id);


--
-- Name: creator_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY issue
    ADD CONSTRAINT creator_id_exists FOREIGN KEY (creator_id) REFERENCES person(id);


--
-- Name: creator_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY note
    ADD CONSTRAINT creator_id_exists FOREIGN KEY (creator_id) REFERENCES person(id);


--
-- Name: creator_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY project_file
    ADD CONSTRAINT creator_id_exists FOREIGN KEY (creator_id) REFERENCES person(id);


--
-- Name: creator_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY question
    ADD CONSTRAINT creator_id_exists FOREIGN KEY (creator_id) REFERENCES person(id);


--
-- Name: creator_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY risk
    ADD CONSTRAINT creator_id_exists FOREIGN KEY (creator_id) REFERENCES person(id);


--
-- Name: parent_project_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY project
    ADD CONSTRAINT parent_project_id_exists FOREIGN KEY (parent_project_id) REFERENCES project(id);


--
-- Name: project_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY issue
    ADD CONSTRAINT project_id_exists FOREIGN KEY (project_id) REFERENCES project(id);


--
-- Name: project_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY note
    ADD CONSTRAINT project_id_exists FOREIGN KEY (project_id) REFERENCES project(id);


--
-- Name: project_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY project_file
    ADD CONSTRAINT project_id_exists FOREIGN KEY (project_id) REFERENCES project(id);


--
-- Name: project_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY question
    ADD CONSTRAINT project_id_exists FOREIGN KEY (project_id) REFERENCES project(id);


--
-- Name: project_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY risk
    ADD CONSTRAINT project_id_exists FOREIGN KEY (project_id) REFERENCES project(id);


--
-- Name: question_id_exists; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY answer
    ADD CONSTRAINT question_id_exists FOREIGN KEY (question_id) REFERENCES question(id);


--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
--

