2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
-- PostgreSQL database dump
|
|
|
|
--
|
|
|
|
|
|
|
|
-- Dumped from database version 9.4.5
|
|
|
|
-- Dumped by pg_dump version 9.4.5
|
2016-01-21 20:30:38 +00:00
|
|
|
-- Started on 2016-01-21 20:29:42 GMT
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
--
|
2015-11-11 13:30:41 +00:00
|
|
|
-- TOC entry 178 (class 3079 OID 11869)
|
2015-11-11 02:06:01 +00:00
|
|
|
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 2041 (class 0 OID 0)
|
2015-11-11 13:30:41 +00:00
|
|
|
-- Dependencies: 178
|
2015-11-11 02:06:01 +00:00
|
|
|
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
|
|
|
|
--
|
|
|
|
|
|
|
|
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
|
|
|
|
|
|
|
|
|
|
|
SET search_path = public, pg_catalog;
|
|
|
|
|
2016-01-07 14:54:01 +00:00
|
|
|
--
|
|
|
|
-- TOC entry 192 (class 1255 OID 31654)
|
|
|
|
-- Name: str_match_partial(text, text, boolean); Type: FUNCTION; Schema: public; Owner: @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 @DB_OWNER_NAME@;
|
|
|
|
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
2015-11-11 13:30:41 +00:00
|
|
|
-- TOC entry 191 (class 1255 OID 31290)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: upcase_hash(); Type: FUNCTION; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
CREATE FUNCTION upcase_hash() RETURNS trigger
|
|
|
|
LANGUAGE plpgsql IMMUTABLE
|
|
|
|
AS $$
|
|
|
|
BEGIN
|
|
|
|
NEW."hash" = UPPER(NEW."hash");
|
|
|
|
RETURN NEW;
|
|
|
|
END;
|
|
|
|
$$;
|
|
|
|
|
|
|
|
|
2016-01-05 14:12:36 +00:00
|
|
|
ALTER FUNCTION public.upcase_hash() OWNER TO @DB_OWNER_NAME@;
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
SET default_tablespace = '';
|
|
|
|
|
|
|
|
SET default_with_oids = false;
|
|
|
|
|
|
|
|
--
|
|
|
|
-- TOC entry 175 (class 1259 OID 31281)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: files; Type: TABLE; Schema: public; Owner: @DB_OWNER_NAME@; Tablespace:
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
|
2015-11-11 13:30:41 +00:00
|
|
|
CREATE TABLE files (
|
2015-11-11 02:06:01 +00:00
|
|
|
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,
|
2015-11-11 13:30:41 +00:00
|
|
|
hash character(48) NOT NULL,
|
|
|
|
is_hash_valid boolean DEFAULT true NOT NULL,
|
2015-12-01 16:35:46 +00:00
|
|
|
access_time timestamp with time zone,
|
|
|
|
modify_time timestamp with time zone,
|
2015-12-10 12:13:16 +00:00
|
|
|
unreadable boolean NOT NULL,
|
2016-01-06 02:18:42 +00:00
|
|
|
mimetype character varying NOT NULL,
|
|
|
|
charset character varying NOT NULL,
|
2015-12-10 12:13:16 +00:00
|
|
|
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))))
|
2015-11-11 02:06:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2016-01-05 14:12:36 +00:00
|
|
|
ALTER TABLE files OWNER TO @DB_OWNER_NAME@;
|
2015-11-11 02:06:01 +00:00
|
|
|
|
2015-12-10 12:13:16 +00:00
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 2042 (class 0 OID 0)
|
2015-12-10 12:13:16 +00:00
|
|
|
-- Dependencies: 175
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: CONSTRAINT chk_hash_0 ON files; Type: COMMENT; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-12-10 12:13:16 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
COMMENT ON CONSTRAINT chk_hash_0 ON files IS 'Make sure hash is 0 if unreadable or not valid are set.';
|
|
|
|
|
|
|
|
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
-- TOC entry 174 (class 1259 OID 31279)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: files_id_seq; Type: SEQUENCE; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
|
2015-11-11 13:30:41 +00:00
|
|
|
CREATE SEQUENCE files_id_seq
|
2015-11-11 02:06:01 +00:00
|
|
|
START WITH 1
|
|
|
|
INCREMENT BY 1
|
|
|
|
NO MINVALUE
|
|
|
|
NO MAXVALUE
|
|
|
|
CACHE 1;
|
|
|
|
|
|
|
|
|
2016-01-05 14:12:36 +00:00
|
|
|
ALTER TABLE files_id_seq OWNER TO @DB_OWNER_NAME@;
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 2043 (class 0 OID 0)
|
2015-11-11 02:06:01 +00:00
|
|
|
-- Dependencies: 174
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
|
2015-11-11 13:30:41 +00:00
|
|
|
ALTER SEQUENCE files_id_seq OWNED BY files.id;
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2015-11-11 13:30:41 +00:00
|
|
|
-- TOC entry 177 (class 1259 OID 31411)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: sets; Type: TABLE; Schema: public; Owner: @DB_OWNER_NAME@; Tablespace:
|
2015-11-11 13:30:41 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE sets (
|
|
|
|
id integer NOT NULL,
|
|
|
|
"desc" text NOT NULL,
|
2015-11-11 20:06:14 +00:00
|
|
|
type character(1) DEFAULT 'D'::bpchar NOT NULL,
|
2015-11-30 18:30:30 +00:00
|
|
|
disk_number integer DEFAULT 0 NOT NULL,
|
|
|
|
creation timestamp with time zone DEFAULT now() NOT NULL,
|
2016-01-21 20:30:38 +00:00
|
|
|
app_name character varying NOT NULL,
|
2015-12-04 12:30:48 +00:00
|
|
|
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)))
|
2015-11-11 13:30:41 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2016-01-05 14:12:36 +00:00
|
|
|
ALTER TABLE sets OWNER TO @DB_OWNER_NAME@;
|
2015-11-11 13:30:41 +00:00
|
|
|
|
2015-11-11 20:06:14 +00:00
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 2044 (class 0 OID 0)
|
2015-11-11 20:06:14 +00:00
|
|
|
-- Dependencies: 177
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: COLUMN sets.type; Type: COMMENT; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-11-11 20:06:14 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
COMMENT ON COLUMN sets.type IS 'D = directory
|
|
|
|
V = DVD
|
|
|
|
B = BluRay
|
|
|
|
F = Floppy Disk
|
|
|
|
H = Hard Disk
|
|
|
|
Z = Iomega Zip
|
|
|
|
O = Other';
|
|
|
|
|
|
|
|
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
2015-11-11 13:30:41 +00:00
|
|
|
-- TOC entry 176 (class 1259 OID 31409)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: sets_id_seq; Type: SEQUENCE; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-11-11 13:30:41 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
CREATE SEQUENCE sets_id_seq
|
|
|
|
START WITH 1
|
|
|
|
INCREMENT BY 1
|
|
|
|
NO MINVALUE
|
|
|
|
NO MAXVALUE
|
|
|
|
CACHE 1;
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
|
2016-01-05 14:12:36 +00:00
|
|
|
ALTER TABLE sets_id_seq OWNER TO @DB_OWNER_NAME@;
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 2045 (class 0 OID 0)
|
2015-11-11 13:30:41 +00:00
|
|
|
-- Dependencies: 176
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: sets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
|
2015-11-11 13:30:41 +00:00
|
|
|
ALTER SEQUENCE sets_id_seq OWNED BY sets.id;
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 1905 (class 2604 OID 31284)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
|
2015-11-11 13:30:41 +00:00
|
|
|
ALTER TABLE ONLY files ALTER COLUMN id SET DEFAULT nextval('files_id_seq'::regclass);
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 1909 (class 2604 OID 31414)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-11-11 13:30:41 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY sets ALTER COLUMN id SET DEFAULT nextval('sets_id_seq'::regclass);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 1918 (class 2606 OID 31289)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: pk_files_id; Type: CONSTRAINT; Schema: public; Owner: @DB_OWNER_NAME@; Tablespace:
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
|
2015-11-11 13:30:41 +00:00
|
|
|
ALTER TABLE ONLY files
|
2015-11-11 02:06:01 +00:00
|
|
|
ADD CONSTRAINT pk_files_id PRIMARY KEY (id);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 1922 (class 2606 OID 31420)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: pk_sets_id; Type: CONSTRAINT; Schema: public; Owner: @DB_OWNER_NAME@; Tablespace:
|
2015-11-11 13:30:41 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY sets
|
|
|
|
ADD CONSTRAINT pk_sets_id PRIMARY KEY (id);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 1920 (class 2606 OID 31294)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: uniq_item; Type: CONSTRAINT; Schema: public; Owner: @DB_OWNER_NAME@; Tablespace:
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
|
2015-11-11 13:30:41 +00:00
|
|
|
ALTER TABLE ONLY files
|
2015-11-11 02:06:01 +00:00
|
|
|
ADD CONSTRAINT uniq_item UNIQUE (path, group_id);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 1914 (class 1259 OID 31426)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: fki_files_sets; Type: INDEX; Schema: public; Owner: @DB_OWNER_NAME@; Tablespace:
|
2015-11-11 13:30:41 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX fki_files_sets ON files USING btree (group_id);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 1915 (class 1259 OID 31651)
|
2016-01-06 02:18:42 +00:00
|
|
|
-- Name: idx_mimetype; Type: INDEX; Schema: public; Owner: @DB_OWNER_NAME@; Tablespace:
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX idx_mimetype ON files USING btree (mimetype, charset);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 1916 (class 1259 OID 31292)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: idx_paths; Type: INDEX; Schema: public; Owner: @DB_OWNER_NAME@; Tablespace:
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
|
2015-11-11 13:30:41 +00:00
|
|
|
CREATE INDEX idx_paths ON files USING btree (path);
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 1924 (class 2620 OID 31291)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: triggerupcasehash; Type: TRIGGER; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-11-11 02:06:01 +00:00
|
|
|
--
|
|
|
|
|
2015-11-11 13:30:41 +00:00
|
|
|
CREATE TRIGGER triggerupcasehash BEFORE INSERT OR UPDATE ON files FOR EACH ROW EXECUTE PROCEDURE upcase_hash();
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 1923 (class 2606 OID 31421)
|
2016-01-05 14:12:36 +00:00
|
|
|
-- Name: fk_files_sets; Type: FK CONSTRAINT; Schema: public; Owner: @DB_OWNER_NAME@
|
2015-11-11 13:30:41 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY files
|
|
|
|
ADD CONSTRAINT fk_files_sets FOREIGN KEY (group_id) REFERENCES sets(id);
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2016-01-07 14:54:01 +00:00
|
|
|
-- TOC entry 2040 (class 0 OID 0)
|
2015-11-11 02:06:01 +00:00
|
|
|
-- Dependencies: 8
|
|
|
|
-- 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;
|
|
|
|
|
|
|
|
|
2016-01-21 20:30:38 +00:00
|
|
|
-- Completed on 2016-01-21 20:29:44 GMT
|
2015-11-11 02:06:01 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- PostgreSQL database dump complete
|
|
|
|
--
|
|
|
|
|