diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1b93546 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +DBNAME = softwareheritage-dev +DB_DUMPS = dumps/swh.dump dumps/swh.sql + +all: + +dumpdb: $(DB_DUMPS) + @if ! echo | psql $(DBNAME) ; then echo "Can't find $(DBNAME). Try make -C ../swh-storage/sql/ distclean filldb" ; false ; fi +dumps/swh.dump: + @if ! echo | psql $(DBNAME) ; then echo "Can't find $(DBNAME). Try make -C ../swh-storage/sql/ distclean filldb" ; false ; fi + pg_dump -F custom --no-owner $(DBNAME) > $@ +dumps/swh.sql: + @if ! echo | psql $(DBNAME) ; then \ + echo "Can't find $(DBNAME). Try make -C ../swh-storage/sql/ distclean filldb" ; \ + false ; \ + fi + pg_dump -F plain --no-owner $(DBNAME) > $@ + +clean: +distclean: clean + rm -f $(DB_DUMPS) diff --git a/README b/README new file mode 100644 index 0000000..e73061c --- /dev/null +++ b/README @@ -0,0 +1,29 @@ +Software Heritage storage test data +=================================== + +How to recreate the DB dumps +---------------------------- + +Periodically you will need to recreate the test data DB dumps, e.g., after a +change in the DB schema. To that end: + +1. you should first ensure that the `softwareheritage-dev` contains the status + of the DB that you want to use in tests. You can achieve that by running + (all commands are relative to swh-environment/ development root) + + make -C swh-storage/sql/ distclean filldb + +2. recreate the DB dumps in this repository + + make -C swh-storage-testdata/ distclean dumpdb + +3. check the textual diff of the SQL dump, to ensure it contains the + differences you want: + + cd swh-storage-testdata + git diff dumps/swh.sql + +4. commit and push your changes + + git commit + git push diff --git a/dumps/swh.dump b/dumps/swh.dump new file mode 100644 index 0000000..914cf60 Binary files /dev/null and b/dumps/swh.dump differ diff --git a/dumps/swh.sql b/dumps/swh.sql new file mode 100644 index 0000000..e51dfc6 --- /dev/null +++ b/dumps/swh.sql @@ -0,0 +1,1380 @@ +-- +-- 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'; + + +-- +-- Name: plpython3u; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: - +-- + +CREATE OR REPLACE PROCEDURAL LANGUAGE plpython3u; + + +-- +-- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public; + + +-- +-- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST'; + + +SET search_path = public, pg_catalog; + +-- +-- Name: sha1; Type: DOMAIN; Schema: public; Owner: - +-- + +CREATE DOMAIN sha1 AS bytea + CONSTRAINT sha1_check CHECK ((length(VALUE) = 20)); + + +-- +-- Name: sha1_git; Type: DOMAIN; Schema: public; Owner: - +-- + +CREATE DOMAIN sha1_git AS bytea + CONSTRAINT sha1_git_check CHECK ((length(VALUE) = 20)); + + +-- +-- Name: sha256; Type: DOMAIN; Schema: public; Owner: - +-- + +CREATE DOMAIN sha256 AS bytea + CONSTRAINT sha256_check CHECK ((length(VALUE) = 32)); + + +-- +-- Name: content_signature; Type: TYPE; Schema: public; Owner: - +-- + +CREATE TYPE content_signature AS ( + sha1 sha1, + sha1_git sha1_git, + sha256 sha256 +); + + +-- +-- Name: content_status; Type: TYPE; Schema: public; Owner: - +-- + +CREATE TYPE content_status AS ENUM ( + 'absent', + 'visible', + 'hidden' +); + + +-- +-- Name: file_perms; Type: DOMAIN; Schema: public; Owner: - +-- + +CREATE DOMAIN file_perms AS integer; + + +-- +-- Name: revision_type; Type: TYPE; Schema: public; Owner: - +-- + +CREATE TYPE revision_type AS ENUM ( + 'git', + 'tar', + 'dsc' +); + + +-- +-- Name: unix_path; Type: DOMAIN; Schema: public; Owner: - +-- + +CREATE DOMAIN unix_path AS text; + + +-- +-- Name: swh_content_add(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION swh_content_add() RETURNS void + LANGUAGE plpgsql + AS $$ +declare + rows bigint; +begin + insert into content (sha1, sha1_git, sha256, length, status) + select distinct sha1, sha1_git, sha256, length, status + from tmp_content + where (sha1, sha1_git, sha256) in + (select * from swh_content_missing()); + -- TODO XXX use postgres 9.5 "UPSERT" support here, when available. + -- Specifically, using "INSERT .. ON CONFLICT IGNORE" we can avoid + -- the extra swh_content_missing() query here. + return; +end +$$; + + +-- +-- Name: swh_content_missing(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION swh_content_missing() RETURNS SETOF content_signature + LANGUAGE plpgsql + AS $$ +begin + return query + select sha1, sha1_git, sha256 from tmp_content + except + select sha1, sha1_git, sha256 from content; + return; +end +$$; + + +-- +-- Name: swh_directory_missing(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION swh_directory_missing() RETURNS SETOF sha1_git + LANGUAGE plpgsql + AS $$ +begin + return query + select id from tmp_directory + except + select id from directory; + return; +end +$$; + + +-- +-- Name: swh_mktemp(regclass); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION swh_mktemp(tblname regclass) RETURNS void + LANGUAGE plpgsql + AS $$ +begin + execute format(' + create temporary table tmp_%I + (like %I including defaults) + on commit drop + ', tblname, tblname); + return; +end +$$; + + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: content; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE content ( + sha1 sha1 NOT NULL, + sha1_git sha1_git NOT NULL, + sha256 sha256 NOT NULL, + length bigint NOT NULL, + ctime timestamp with time zone DEFAULT now() NOT NULL, + status content_status DEFAULT 'visible'::content_status NOT NULL +); + + +-- +-- Name: dbversion; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE dbversion ( + version integer NOT NULL, + release timestamp with time zone, + description text +); + + +-- +-- Name: directory; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE directory ( + id sha1_git NOT NULL +); + + +-- +-- Name: directory_entry_dir; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE directory_entry_dir ( + id bigint NOT NULL, + target sha1_git, + name unix_path, + perms file_perms, + atime timestamp with time zone, + mtime timestamp with time zone, + ctime timestamp with time zone +); + + +-- +-- Name: directory_entry_dir_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE directory_entry_dir_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: directory_entry_dir_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE directory_entry_dir_id_seq OWNED BY directory_entry_dir.id; + + +-- +-- Name: directory_entry_file; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE directory_entry_file ( + id bigint NOT NULL, + target sha1_git, + name unix_path, + perms file_perms, + atime timestamp with time zone, + mtime timestamp with time zone, + ctime timestamp with time zone +); + + +-- +-- Name: directory_entry_file_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE directory_entry_file_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: directory_entry_file_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE directory_entry_file_id_seq OWNED BY directory_entry_file.id; + + +-- +-- Name: directory_entry_rev; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE directory_entry_rev ( + id bigint NOT NULL, + target sha1_git, + name unix_path, + perms file_perms, + atime timestamp with time zone, + mtime timestamp with time zone, + ctime timestamp with time zone +); + + +-- +-- Name: directory_entry_rev_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE directory_entry_rev_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: directory_entry_rev_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE directory_entry_rev_id_seq OWNED BY directory_entry_rev.id; + + +-- +-- Name: directory_list_dir; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE directory_list_dir ( + dir_id sha1_git NOT NULL, + entry_id bigint NOT NULL +); + + +-- +-- Name: directory_list_file; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE directory_list_file ( + dir_id sha1_git NOT NULL, + entry_id bigint NOT NULL +); + + +-- +-- Name: directory_list_rev; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE directory_list_rev ( + dir_id sha1_git NOT NULL, + entry_id bigint NOT NULL +); + + +-- +-- Name: fetch_history; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE fetch_history ( + id bigint NOT NULL, + origin bigint, + date timestamp with time zone NOT NULL, + status boolean, + result json, + stdout text, + stderr text, + duration interval +); + + +-- +-- Name: fetch_history_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE fetch_history_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: fetch_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE fetch_history_id_seq OWNED BY fetch_history.id; + + +-- +-- Name: list_history; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE list_history ( + id bigint NOT NULL, + organization bigint, + date timestamp with time zone NOT NULL, + status boolean, + result json, + stdout text, + stderr text, + duration interval +); + + +-- +-- Name: list_history_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE list_history_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: list_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE list_history_id_seq OWNED BY list_history.id; + + +-- +-- Name: occurrence; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE occurrence ( + origin bigint NOT NULL, + branch text NOT NULL, + revision sha1_git NOT NULL +); + + +-- +-- Name: occurrence_history; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE occurrence_history ( + origin bigint NOT NULL, + branch text NOT NULL, + revision sha1_git NOT NULL, + authority bigint NOT NULL, + validity tstzrange NOT NULL +); + + +-- +-- Name: organization; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE organization ( + id bigint NOT NULL, + parent_id bigint, + name text NOT NULL, + description text, + homepage text, + list_engine text, + list_url text, + list_params json, + latest_list timestamp with time zone +); + + +-- +-- Name: organization_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE organization_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: organization_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE organization_id_seq OWNED BY organization.id; + + +-- +-- Name: origin; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE origin ( + id bigint NOT NULL, + type text, + url text NOT NULL +); + + +-- +-- Name: origin_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE origin_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: origin_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE origin_id_seq OWNED BY origin.id; + + +-- +-- Name: person; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE person ( + id bigint NOT NULL, + name text, + email text +); + + +-- +-- Name: person_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE person_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: person_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE person_id_seq OWNED BY person.id; + + +-- +-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE project ( + id bigint NOT NULL, + organization bigint, + origin bigint, + name text, + description text, + homepage text, + doap jsonb +); + + +-- +-- Name: project_history; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE project_history ( + id bigint NOT NULL, + project bigint, + validity tstzrange, + organization bigint, + origin bigint, + name text, + description text, + homepage text, + doap jsonb +); + + +-- +-- Name: project_history_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE project_history_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: project_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE project_history_id_seq OWNED BY project_history.id; + + +-- +-- Name: project_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE project_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: project_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE project_id_seq OWNED BY project.id; + + +-- +-- Name: release; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE release ( + id sha1_git NOT NULL, + revision sha1_git, + date timestamp with time zone, + name text, + comment text, + author bigint +); + + +-- +-- Name: revision; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE revision ( + id sha1_git NOT NULL, + date timestamp with time zone, + committer_date timestamp with time zone, + type revision_type NOT NULL, + directory sha1_git, + message text, + author bigint, + committer bigint +); + + +-- +-- Name: revision_history; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE revision_history ( + id sha1_git NOT NULL, + parent_id sha1_git NOT NULL, + parent_rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY directory_entry_dir ALTER COLUMN id SET DEFAULT nextval('directory_entry_dir_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY directory_entry_file ALTER COLUMN id SET DEFAULT nextval('directory_entry_file_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY directory_entry_rev ALTER COLUMN id SET DEFAULT nextval('directory_entry_rev_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY fetch_history ALTER COLUMN id SET DEFAULT nextval('fetch_history_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY list_history ALTER COLUMN id SET DEFAULT nextval('list_history_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY organization ALTER COLUMN id SET DEFAULT nextval('organization_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY origin ALTER COLUMN id SET DEFAULT nextval('origin_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY person ALTER COLUMN id SET DEFAULT nextval('person_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project ALTER COLUMN id SET DEFAULT nextval('project_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project_history ALTER COLUMN id SET DEFAULT nextval('project_history_id_seq'::regclass); + + +-- +-- Data for Name: content; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY content (sha1, sha1_git, sha256, length, ctime, status) FROM stdin; +\. + + +-- +-- Data for Name: dbversion; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY dbversion (version, release, description) FROM stdin; +13 2015-09-14 18:56:12.634076+02 Work In Progress +\. + + +-- +-- Data for Name: directory; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY directory (id) FROM stdin; +\. + + +-- +-- Data for Name: directory_entry_dir; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY directory_entry_dir (id, target, name, perms, atime, mtime, ctime) FROM stdin; +\. + + +-- +-- Name: directory_entry_dir_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('directory_entry_dir_id_seq', 1, false); + + +-- +-- Data for Name: directory_entry_file; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY directory_entry_file (id, target, name, perms, atime, mtime, ctime) FROM stdin; +\. + + +-- +-- Name: directory_entry_file_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('directory_entry_file_id_seq', 1, false); + + +-- +-- Data for Name: directory_entry_rev; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY directory_entry_rev (id, target, name, perms, atime, mtime, ctime) FROM stdin; +\. + + +-- +-- Name: directory_entry_rev_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('directory_entry_rev_id_seq', 1, false); + + +-- +-- Data for Name: directory_list_dir; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY directory_list_dir (dir_id, entry_id) FROM stdin; +\. + + +-- +-- Data for Name: directory_list_file; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY directory_list_file (dir_id, entry_id) FROM stdin; +\. + + +-- +-- Data for Name: directory_list_rev; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY directory_list_rev (dir_id, entry_id) FROM stdin; +\. + + +-- +-- Data for Name: fetch_history; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY fetch_history (id, origin, date, status, result, stdout, stderr, duration) FROM stdin; +\. + + +-- +-- Name: fetch_history_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('fetch_history_id_seq', 1, false); + + +-- +-- Data for Name: list_history; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY list_history (id, organization, date, status, result, stdout, stderr, duration) FROM stdin; +\. + + +-- +-- Name: list_history_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('list_history_id_seq', 1, false); + + +-- +-- Data for Name: occurrence; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY occurrence (origin, branch, revision) FROM stdin; +\. + + +-- +-- Data for Name: occurrence_history; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY occurrence_history (origin, branch, revision, authority, validity) FROM stdin; +\. + + +-- +-- Data for Name: organization; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY organization (id, parent_id, name, description, homepage, list_engine, list_url, list_params, latest_list) FROM stdin; +1 \N softwareheritage Software Heritage http://www.softwareheritage.org \N \N \N \N +\. + + +-- +-- Name: organization_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('organization_id_seq', 1, true); + + +-- +-- Data for Name: origin; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY origin (id, type, url) FROM stdin; +\. + + +-- +-- Name: origin_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('origin_id_seq', 1, false); + + +-- +-- Data for Name: person; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY person (id, name, email) FROM stdin; +\. + + +-- +-- Name: person_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('person_id_seq', 1, false); + + +-- +-- Data for Name: project; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY project (id, organization, origin, name, description, homepage, doap) FROM stdin; +\. + + +-- +-- Data for Name: project_history; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY project_history (id, project, validity, organization, origin, name, description, homepage, doap) FROM stdin; +\. + + +-- +-- Name: project_history_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('project_history_id_seq', 1, false); + + +-- +-- Name: project_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('project_id_seq', 1, false); + + +-- +-- Data for Name: release; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY release (id, revision, date, name, comment, author) FROM stdin; +\. + + +-- +-- Data for Name: revision; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY revision (id, date, committer_date, type, directory, message, author, committer) FROM stdin; +\. + + +-- +-- Data for Name: revision_history; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY revision_history (id, parent_id, parent_rank) FROM stdin; +\. + + +-- +-- Name: content_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY content + ADD CONSTRAINT content_pkey PRIMARY KEY (sha1); + + +-- +-- Name: dbversion_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dbversion + ADD CONSTRAINT dbversion_pkey PRIMARY KEY (version); + + +-- +-- Name: directory_entry_dir_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY directory_entry_dir + ADD CONSTRAINT directory_entry_dir_pkey PRIMARY KEY (id); + + +-- +-- Name: directory_entry_file_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY directory_entry_file + ADD CONSTRAINT directory_entry_file_pkey PRIMARY KEY (id); + + +-- +-- Name: directory_entry_rev_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY directory_entry_rev + ADD CONSTRAINT directory_entry_rev_pkey PRIMARY KEY (id); + + +-- +-- Name: directory_list_dir_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY directory_list_dir + ADD CONSTRAINT directory_list_dir_pkey PRIMARY KEY (dir_id, entry_id); + + +-- +-- Name: directory_list_file_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY directory_list_file + ADD CONSTRAINT directory_list_file_pkey PRIMARY KEY (dir_id, entry_id); + + +-- +-- Name: directory_list_rev_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY directory_list_rev + ADD CONSTRAINT directory_list_rev_pkey PRIMARY KEY (dir_id, entry_id); + + +-- +-- Name: directory_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY directory + ADD CONSTRAINT directory_pkey PRIMARY KEY (id); + + +-- +-- Name: fetch_history_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY fetch_history + ADD CONSTRAINT fetch_history_pkey PRIMARY KEY (id); + + +-- +-- Name: list_history_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY list_history + ADD CONSTRAINT list_history_pkey PRIMARY KEY (id); + + +-- +-- Name: occurrence_history_origin_branch_revision_authority_validi_excl; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY occurrence_history + ADD CONSTRAINT occurrence_history_origin_branch_revision_authority_validi_excl EXCLUDE USING gist (origin WITH =, branch WITH =, revision WITH =, authority WITH =, validity WITH &&); + + +-- +-- Name: occurrence_history_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY occurrence_history + ADD CONSTRAINT occurrence_history_pkey PRIMARY KEY (origin, branch, revision, authority, validity); + + +-- +-- Name: occurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY occurrence + ADD CONSTRAINT occurrence_pkey PRIMARY KEY (origin, branch, revision); + + +-- +-- Name: organization_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organization + ADD CONSTRAINT organization_pkey PRIMARY KEY (id); + + +-- +-- Name: origin_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY origin + ADD CONSTRAINT origin_pkey PRIMARY KEY (id); + + +-- +-- Name: person_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY person + ADD CONSTRAINT person_pkey PRIMARY KEY (id); + + +-- +-- Name: project_history_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY project_history + ADD CONSTRAINT project_history_pkey PRIMARY KEY (id); + + +-- +-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY project + ADD CONSTRAINT project_pkey PRIMARY KEY (id); + + +-- +-- Name: release_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY release + ADD CONSTRAINT release_pkey PRIMARY KEY (id); + + +-- +-- Name: revision_history_id_parent_rank_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY revision_history + ADD CONSTRAINT revision_history_id_parent_rank_key UNIQUE (id, parent_rank); + + +-- +-- Name: revision_history_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY revision_history + ADD CONSTRAINT revision_history_pkey PRIMARY KEY (id, parent_id); + + +-- +-- Name: revision_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY revision + ADD CONSTRAINT revision_pkey PRIMARY KEY (id); + + +-- +-- Name: content_sha1_git_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX content_sha1_git_idx ON content USING btree (sha1_git); + + +-- +-- Name: directory_entry_dir_target_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY directory_entry_dir + ADD CONSTRAINT directory_entry_dir_target_fkey FOREIGN KEY (target) REFERENCES directory(id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: directory_list_dir_dir_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY directory_list_dir + ADD CONSTRAINT directory_list_dir_dir_id_fkey FOREIGN KEY (dir_id) REFERENCES directory(id); + + +-- +-- Name: directory_list_dir_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY directory_list_dir + ADD CONSTRAINT directory_list_dir_entry_id_fkey FOREIGN KEY (entry_id) REFERENCES directory_entry_dir(id); + + +-- +-- Name: directory_list_file_dir_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY directory_list_file + ADD CONSTRAINT directory_list_file_dir_id_fkey FOREIGN KEY (dir_id) REFERENCES directory(id); + + +-- +-- Name: directory_list_file_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY directory_list_file + ADD CONSTRAINT directory_list_file_entry_id_fkey FOREIGN KEY (entry_id) REFERENCES directory_entry_file(id); + + +-- +-- Name: directory_list_rev_dir_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY directory_list_rev + ADD CONSTRAINT directory_list_rev_dir_id_fkey FOREIGN KEY (dir_id) REFERENCES directory(id); + + +-- +-- Name: directory_list_rev_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY directory_list_rev + ADD CONSTRAINT directory_list_rev_entry_id_fkey FOREIGN KEY (entry_id) REFERENCES directory_entry_rev(id); + + +-- +-- Name: fetch_history_origin_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY fetch_history + ADD CONSTRAINT fetch_history_origin_fkey FOREIGN KEY (origin) REFERENCES origin(id); + + +-- +-- Name: list_history_organization_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY list_history + ADD CONSTRAINT list_history_organization_fkey FOREIGN KEY (organization) REFERENCES organization(id); + + +-- +-- Name: occurrence_history_authority_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY occurrence_history + ADD CONSTRAINT occurrence_history_authority_fkey FOREIGN KEY (authority) REFERENCES organization(id); + + +-- +-- Name: occurrence_history_origin_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY occurrence_history + ADD CONSTRAINT occurrence_history_origin_fkey FOREIGN KEY (origin) REFERENCES origin(id); + + +-- +-- Name: occurrence_history_revision_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY occurrence_history + ADD CONSTRAINT occurrence_history_revision_fkey FOREIGN KEY (revision) REFERENCES revision(id); + + +-- +-- Name: occurrence_origin_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY occurrence + ADD CONSTRAINT occurrence_origin_fkey FOREIGN KEY (origin) REFERENCES origin(id); + + +-- +-- Name: occurrence_revision_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY occurrence + ADD CONSTRAINT occurrence_revision_fkey FOREIGN KEY (revision) REFERENCES revision(id); + + +-- +-- Name: organization_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY organization + ADD CONSTRAINT organization_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES organization(id); + + +-- +-- Name: project_history_organization_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project_history + ADD CONSTRAINT project_history_organization_fkey FOREIGN KEY (organization) REFERENCES organization(id); + + +-- +-- Name: project_history_origin_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project_history + ADD CONSTRAINT project_history_origin_fkey FOREIGN KEY (origin) REFERENCES origin(id); + + +-- +-- Name: project_history_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project_history + ADD CONSTRAINT project_history_project_fkey FOREIGN KEY (project) REFERENCES project(id); + + +-- +-- Name: project_organization_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project + ADD CONSTRAINT project_organization_fkey FOREIGN KEY (organization) REFERENCES organization(id); + + +-- +-- Name: project_origin_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project + ADD CONSTRAINT project_origin_fkey FOREIGN KEY (origin) REFERENCES origin(id); + + +-- +-- Name: release_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY release + ADD CONSTRAINT release_author_fkey FOREIGN KEY (author) REFERENCES person(id); + + +-- +-- Name: release_revision_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY release + ADD CONSTRAINT release_revision_fkey FOREIGN KEY (revision) REFERENCES revision(id); + + +-- +-- Name: revision_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY revision + ADD CONSTRAINT revision_author_fkey FOREIGN KEY (author) REFERENCES person(id); + + +-- +-- Name: revision_committer_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY revision + ADD CONSTRAINT revision_committer_fkey FOREIGN KEY (committer) REFERENCES person(id); + + +-- +-- Name: revision_history_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY revision_history + ADD CONSTRAINT revision_history_id_fkey FOREIGN KEY (id) REFERENCES revision(id); + + +-- +-- Name: public; Type: ACL; Schema: -; Owner: - +-- + +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; + + +-- +-- PostgreSQL database dump complete +-- +