-- -- PostgreSQL database dump -- -- Dumped from database version 9.5.2 -- Dumped by pg_dump version 9.5.2 -- Started on 2016-06-03 20:30:32 CEST 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; SET row_security = off; -- -- TOC entry 1 (class 3079 OID 12373) -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; -- -- TOC entry 2152 (class 0 OID 0) -- Dependencies: 1 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -- COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; SET search_path = public, pg_catalog; -- -- TOC entry 185 (class 1255 OID 16386) -- Name: str_begins_with(text, text); Type: FUNCTION; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE FUNCTION str_begins_with(text, text) RETURNS boolean LANGUAGE sql IMMUTABLE AS $_$SELECT $1 LIKE regexp_replace($2||'', '(\%_)', '\\1')||'%'; $_$; ALTER FUNCTION public.str_begins_with(text, text) OWNER TO @DINDEXER_DB_OWNER_NAME@; -- -- TOC entry 186 (class 1255 OID 16387) -- Name: str_match_partial(text, text, boolean); Type: FUNCTION; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE FUNCTION str_match_partial(text, text, boolean) RETURNS boolean LANGUAGE sql IMMUTABLE AS $_$SELECT CASE WHEN $3 THEN LOWER($1) LIKE LOWER('%'||regexp_replace($2, '(\%_)', '\\1')||'%') ELSE $1 LIKE '%'||regexp_replace($2, '(\%_)', '\\1')||'%' END; $_$; ALTER FUNCTION public.str_match_partial(text, text, boolean) OWNER TO @DINDEXER_DB_OWNER_NAME@; -- -- TOC entry 187 (class 1255 OID 16388) -- Name: upcase_hash(); Type: FUNCTION; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE FUNCTION upcase_hash() RETURNS trigger LANGUAGE plpgsql IMMUTABLE AS $$ BEGIN NEW."hash" = UPPER(NEW."hash"); RETURN NEW; END; $$; ALTER FUNCTION public.upcase_hash() OWNER TO @DINDEXER_DB_OWNER_NAME@; SET default_tablespace = ''; SET default_with_oids = false; -- -- TOC entry 181 (class 1259 OID 16389) -- Name: files; Type: TABLE; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE TABLE files ( id bigint NOT NULL, path text NOT NULL, level smallint NOT NULL, group_id integer NOT NULL, is_directory boolean NOT NULL, is_symlink boolean NOT NULL, size bigint, hash character(48) NOT NULL, is_hash_valid boolean DEFAULT true NOT NULL, access_time timestamp with time zone, modify_time timestamp with time zone, unreadable boolean NOT NULL, mimetype character varying NOT NULL, charset character varying NOT NULL, tags text[] DEFAULT '{}'::text[] NOT NULL, CONSTRAINT chk_files_dirsize_zero CHECK (((is_directory = false) OR (size = 0))), CONSTRAINT chk_hash_0 CHECK ((((NOT unreadable) AND is_hash_valid) OR ((NOT is_hash_valid) AND (hash ~ '^0+$'::text)))) ); ALTER TABLE files OWNER TO @DINDEXER_DB_OWNER_NAME@; -- -- TOC entry 2153 (class 0 OID 0) -- Dependencies: 181 -- Name: CONSTRAINT chk_hash_0 ON files; Type: COMMENT; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- COMMENT ON CONSTRAINT chk_hash_0 ON files IS 'Make sure hash is 0 if unreadable or not valid are set.'; -- -- TOC entry 182 (class 1259 OID 16398) -- Name: files_id_seq; Type: SEQUENCE; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE SEQUENCE files_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE files_id_seq OWNER TO @DINDEXER_DB_OWNER_NAME@; -- -- TOC entry 2154 (class 0 OID 0) -- Dependencies: 182 -- Name: files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- ALTER SEQUENCE files_id_seq OWNED BY files.id; -- -- TOC entry 183 (class 1259 OID 16400) -- Name: sets; Type: TABLE; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE TABLE sets ( id integer NOT NULL, "desc" text NOT NULL, type character(1) DEFAULT 'D'::bpchar NOT NULL, disk_number integer DEFAULT 0 NOT NULL, creation timestamp with time zone DEFAULT now() NOT NULL, app_name character varying NOT NULL, content_type character(1) DEFAULT 'G'::bpchar NOT NULL, disk_label text NOT NULL, fs_uuid text NOT NULL, CONSTRAINT chk_sets_type CHECK (((type = 'C'::bpchar) OR (type = 'D'::bpchar) OR (type = 'V'::bpchar) OR (type = 'B'::bpchar) OR (type = 'F'::bpchar) OR (type = 'H'::bpchar) OR (type = 'Z'::bpchar) OR (type = 'O'::bpchar))) ); ALTER TABLE sets OWNER TO @DINDEXER_DB_OWNER_NAME@; -- -- TOC entry 2155 (class 0 OID 0) -- Dependencies: 183 -- Name: COLUMN sets.type; Type: COMMENT; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- COMMENT ON COLUMN sets.type IS 'D = directory V = DVD B = BluRay F = Floppy Disk H = Hard Disk Z = Iomega Zip O = Other'; -- -- TOC entry 184 (class 1259 OID 16411) -- Name: sets_id_seq; Type: SEQUENCE; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE SEQUENCE sets_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE sets_id_seq OWNER TO @DINDEXER_DB_OWNER_NAME@; -- -- TOC entry 2156 (class 0 OID 0) -- Dependencies: 184 -- Name: sets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- ALTER SEQUENCE sets_id_seq OWNED BY sets.id; -- -- TOC entry 2009 (class 2604 OID 16413) -- Name: id; Type: DEFAULT; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- ALTER TABLE ONLY files ALTER COLUMN id SET DEFAULT nextval('files_id_seq'::regclass); -- -- TOC entry 2017 (class 2604 OID 16414) -- Name: id; Type: DEFAULT; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- ALTER TABLE ONLY sets ALTER COLUMN id SET DEFAULT nextval('sets_id_seq'::regclass); -- -- TOC entry 2024 (class 2606 OID 16416) -- Name: pk_files_id; Type: CONSTRAINT; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- ALTER TABLE ONLY files ADD CONSTRAINT pk_files_id PRIMARY KEY (id); -- -- TOC entry 2028 (class 2606 OID 16418) -- Name: pk_sets_id; Type: CONSTRAINT; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- ALTER TABLE ONLY sets ADD CONSTRAINT pk_sets_id PRIMARY KEY (id); -- -- TOC entry 2026 (class 2606 OID 16420) -- Name: uniq_item; Type: CONSTRAINT; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- ALTER TABLE ONLY files ADD CONSTRAINT uniq_item UNIQUE (path, group_id); -- -- TOC entry 2019 (class 1259 OID 16421) -- Name: fki_files_sets; Type: INDEX; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE INDEX fki_files_sets ON files USING btree (group_id); -- -- TOC entry 2020 (class 1259 OID 16422) -- Name: idx_mimetype; Type: INDEX; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE INDEX idx_mimetype ON files USING btree (mimetype, charset); -- -- TOC entry 2021 (class 1259 OID 16423) -- Name: idx_paths; Type: INDEX; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE INDEX idx_paths ON files USING btree (path); -- -- TOC entry 2022 (class 1259 OID 16475) -- Name: idx_tags; Type: INDEX; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE INDEX idx_tags ON files USING gin (tags); -- -- TOC entry 2030 (class 2620 OID 16424) -- Name: triggerupcasehash; Type: TRIGGER; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- CREATE TRIGGER triggerupcasehash BEFORE INSERT OR UPDATE ON files FOR EACH ROW EXECUTE PROCEDURE upcase_hash(); -- -- TOC entry 2029 (class 2606 OID 16425) -- Name: fk_files_sets; Type: FK CONSTRAINT; Schema: public; Owner: @DINDEXER_DB_OWNER_NAME@ -- ALTER TABLE ONLY files ADD CONSTRAINT fk_files_sets FOREIGN KEY (group_id) REFERENCES sets(id); -- -- TOC entry 2151 (class 0 OID 0) -- Dependencies: 7 -- 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; -- Completed on 2016-06-03 20:30:33 CEST -- -- PostgreSQL database dump complete --