From 44fbbe7458d18223844cbb1e6c98f9f6437fa3ee Mon Sep 17 00:00:00 2001 From: Lars Vierbergen Date: Mon, 19 Jul 2021 13:35:53 +0200 Subject: [PATCH 1/2] Add development setup with a postgresql container --- development/docker-compose.yml | 26 + development/postgres/01-schema.sql | 1339 ++++++++++++++++++++++++++ development/postgres/02-testdata.sql | 77 ++ 3 files changed, 1442 insertions(+) create mode 100644 development/docker-compose.yml create mode 100644 development/postgres/01-schema.sql create mode 100644 development/postgres/02-testdata.sql diff --git a/development/docker-compose.yml b/development/docker-compose.yml new file mode 100644 index 0000000..4431cf1 --- /dev/null +++ b/development/docker-compose.yml @@ -0,0 +1,26 @@ +version: '2.2' + +services: + bareos_exporter: + ports: + - 9625 + build: + context: .. + command: + - "-dsn" + - "postgres://host=database user=postgres password=postgres dbname=postgres sslmode=disable" + - "-job-discovery-days" + - "20" + depends_on: + - database + + database: + image: postgres + environment: + POSTGRES_PASSWORD: postgres + volumes: + - postgres:/var/lib/postgresql/data + - ./postgres:/docker-entrypoint-initdb.d/:ro + +volumes: + postgres: diff --git a/development/postgres/01-schema.sql b/development/postgres/01-schema.sql new file mode 100644 index 0000000..4893ebe --- /dev/null +++ b/development/postgres/01-schema.sql @@ -0,0 +1,1339 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.22 +-- Dumped by pg_dump version 9.6.22 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'SQL_ASCII'; +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: 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'; + + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: basefiles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.basefiles ( + baseid integer NOT NULL, + jobid integer NOT NULL, + fileid bigint NOT NULL, + fileindex integer, + basejobid integer +); + + +-- +-- Name: basefiles_baseid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.basefiles_baseid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: basefiles_baseid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.basefiles_baseid_seq OWNED BY public.basefiles.baseid; + + +-- +-- Name: client; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.client ( + clientid integer NOT NULL, + name text NOT NULL, + uname text NOT NULL, + autoprune smallint DEFAULT 0, + fileretention bigint DEFAULT 0, + jobretention bigint DEFAULT 0 +); + + +-- +-- Name: client_clientid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.client_clientid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: client_clientid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.client_clientid_seq OWNED BY public.client.clientid; + + +-- +-- Name: counters; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.counters ( + counter text NOT NULL, + minvalue integer DEFAULT 0, + maxvalue integer DEFAULT 0, + currentvalue integer DEFAULT 0, + wrapcounter text NOT NULL +); + + +-- +-- Name: device; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.device ( + deviceid integer NOT NULL, + name text NOT NULL, + mediatypeid integer NOT NULL, + storageid integer NOT NULL, + devmounts integer DEFAULT 0 NOT NULL, + devreadbytes bigint DEFAULT 0 NOT NULL, + devwritebytes bigint DEFAULT 0 NOT NULL, + devreadbytessincecleaning bigint DEFAULT 0 NOT NULL, + devwritebytessincecleaning bigint DEFAULT 0 NOT NULL, + devreadtime bigint DEFAULT 0 NOT NULL, + devwritetime bigint DEFAULT 0 NOT NULL, + devreadtimesincecleaning bigint DEFAULT 0 NOT NULL, + devwritetimesincecleaning bigint DEFAULT 0 NOT NULL, + cleaningdate timestamp without time zone, + cleaningperiod bigint DEFAULT 0 NOT NULL +); + + +-- +-- Name: device_deviceid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.device_deviceid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: device_deviceid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.device_deviceid_seq OWNED BY public.device.deviceid; + + +-- +-- Name: devicestats; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.devicestats ( + deviceid integer DEFAULT 0, + sampletime timestamp without time zone NOT NULL, + readtime bigint DEFAULT 0 NOT NULL, + writetime bigint DEFAULT 0 NOT NULL, + readbytes bigint DEFAULT 0, + writebytes bigint DEFAULT 0, + spoolsize bigint DEFAULT 0, + numwaiting smallint DEFAULT 0, + numwriters smallint DEFAULT 0, + mediaid integer NOT NULL, + volcatbytes bigint DEFAULT 0, + volcatfiles bigint DEFAULT 0, + volcatblocks bigint DEFAULT 0 +); + + +-- +-- Name: file; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.file ( + fileid bigint NOT NULL, + fileindex integer DEFAULT 0 NOT NULL, + jobid integer NOT NULL, + pathid integer NOT NULL, + filenameid integer NOT NULL, + deltaseq smallint DEFAULT 0 NOT NULL, + markid integer DEFAULT 0 NOT NULL, + lstat text NOT NULL, + md5 text NOT NULL +); + + +-- +-- Name: file_fileid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.file_fileid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: file_fileid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.file_fileid_seq OWNED BY public.file.fileid; + + +-- +-- Name: filename; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.filename ( + filenameid integer NOT NULL, + name text NOT NULL +); +ALTER TABLE ONLY public.filename ALTER COLUMN name SET STATISTICS 1000; + + +-- +-- Name: filename_filenameid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.filename_filenameid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: filename_filenameid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.filename_filenameid_seq OWNED BY public.filename.filenameid; + + +-- +-- Name: fileset; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.fileset ( + filesetid integer NOT NULL, + fileset text NOT NULL, + filesettext text DEFAULT ''::text, + md5 text NOT NULL, + createtime timestamp without time zone NOT NULL +); + + +-- +-- Name: fileset_filesetid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.fileset_filesetid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: fileset_filesetid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.fileset_filesetid_seq OWNED BY public.fileset.filesetid; + + +-- +-- Name: job; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.job ( + jobid integer NOT NULL, + job text NOT NULL, + name text NOT NULL, + type character(1) NOT NULL, + level character(1) NOT NULL, + clientid integer DEFAULT 0, + jobstatus character(1) NOT NULL, + schedtime timestamp without time zone, + starttime timestamp without time zone, + endtime timestamp without time zone, + realendtime timestamp without time zone, + jobtdate bigint DEFAULT 0, + volsessionid integer DEFAULT 0, + volsessiontime integer DEFAULT 0, + jobfiles integer DEFAULT 0, + jobbytes bigint DEFAULT 0, + readbytes bigint DEFAULT 0, + joberrors integer DEFAULT 0, + jobmissingfiles integer DEFAULT 0, + poolid integer DEFAULT 0, + filesetid integer DEFAULT 0, + priorjobid integer DEFAULT 0, + purgedfiles smallint DEFAULT 0, + hasbase smallint DEFAULT 0, + hascache smallint DEFAULT 0, + reviewed smallint DEFAULT 0, + comment text +); + + +-- +-- Name: job_jobid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.job_jobid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: job_jobid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.job_jobid_seq OWNED BY public.job.jobid; + + +-- +-- Name: jobhisto; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.jobhisto ( + jobid integer NOT NULL, + job text NOT NULL, + name text NOT NULL, + type character(1) NOT NULL, + level character(1) NOT NULL, + clientid integer, + jobstatus character(1) NOT NULL, + schedtime timestamp without time zone, + starttime timestamp without time zone, + endtime timestamp without time zone, + realendtime timestamp without time zone, + jobtdate bigint, + volsessionid integer, + volsessiontime integer, + jobfiles integer, + jobbytes bigint, + readbytes bigint, + joberrors integer, + jobmissingfiles integer, + poolid integer, + filesetid integer, + priorjobid integer, + purgedfiles smallint, + hasbase smallint, + hascache smallint, + reviewed smallint, + comment text +); + + +-- +-- Name: jobmedia; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.jobmedia ( + jobmediaid integer NOT NULL, + jobid integer NOT NULL, + mediaid integer NOT NULL, + firstindex integer DEFAULT 0, + lastindex integer DEFAULT 0, + startfile integer DEFAULT 0, + endfile integer DEFAULT 0, + startblock bigint DEFAULT 0, + endblock bigint DEFAULT 0, + volindex integer DEFAULT 0 +); + + +-- +-- Name: jobmedia_jobmediaid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.jobmedia_jobmediaid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: jobmedia_jobmediaid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.jobmedia_jobmediaid_seq OWNED BY public.jobmedia.jobmediaid; + + +-- +-- Name: jobstats; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.jobstats ( + deviceid integer DEFAULT 0, + sampletime timestamp without time zone NOT NULL, + jobid integer NOT NULL, + jobfiles integer DEFAULT 0, + jobbytes bigint DEFAULT 0 +); + + +-- +-- Name: location; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.location ( + locationid integer NOT NULL, + location text NOT NULL, + cost integer DEFAULT 0, + enabled smallint +); + + +-- +-- Name: location_locationid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.location_locationid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: location_locationid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.location_locationid_seq OWNED BY public.location.locationid; + + +-- +-- Name: locationlog; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.locationlog ( + loclogid integer NOT NULL, + date timestamp without time zone, + comment text NOT NULL, + mediaid integer DEFAULT 0, + locationid integer DEFAULT 0, + newvolstatus text NOT NULL, + newenabled smallint, + CONSTRAINT locationlog_newvolstatus_check CHECK ((newvolstatus = ANY (ARRAY['Full'::text, 'Archive'::text, 'Append'::text, 'Recycle'::text, 'Purged'::text, 'Read-Only'::text, 'Disabled'::text, 'Error'::text, 'Busy'::text, 'Used'::text, 'Cleaning'::text, 'Scratch'::text]))) +); + + +-- +-- Name: locationlog_loclogid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.locationlog_loclogid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: locationlog_loclogid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.locationlog_loclogid_seq OWNED BY public.locationlog.loclogid; + + +-- +-- Name: log; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.log ( + logid integer NOT NULL, + jobid integer NOT NULL, + "time" timestamp without time zone, + logtext text NOT NULL +); + + +-- +-- Name: log_logid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.log_logid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: log_logid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.log_logid_seq OWNED BY public.log.logid; + + +-- +-- Name: media; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.media ( + mediaid integer NOT NULL, + volumename text NOT NULL, + slot integer DEFAULT 0, + poolid integer DEFAULT 0, + mediatype text NOT NULL, + mediatypeid integer DEFAULT 0, + labeltype integer DEFAULT 0, + firstwritten timestamp without time zone, + lastwritten timestamp without time zone, + labeldate timestamp without time zone, + voljobs integer DEFAULT 0, + volfiles integer DEFAULT 0, + volblocks integer DEFAULT 0, + volmounts integer DEFAULT 0, + volbytes bigint DEFAULT 0, + volerrors integer DEFAULT 0, + volwrites integer DEFAULT 0, + volcapacitybytes bigint DEFAULT 0, + volstatus text NOT NULL, + enabled smallint DEFAULT 1, + recycle smallint DEFAULT 0, + actiononpurge smallint DEFAULT 0, + volretention bigint DEFAULT 0, + voluseduration bigint DEFAULT 0, + maxvoljobs integer DEFAULT 0, + maxvolfiles integer DEFAULT 0, + maxvolbytes bigint DEFAULT 0, + inchanger smallint DEFAULT 0, + storageid integer DEFAULT 0, + deviceid integer DEFAULT 0, + mediaaddressing smallint DEFAULT 0, + volreadtime bigint DEFAULT 0, + volwritetime bigint DEFAULT 0, + endfile integer DEFAULT 0, + endblock bigint DEFAULT 0, + locationid integer DEFAULT 0, + recyclecount integer DEFAULT 0, + minblocksize integer DEFAULT 0, + maxblocksize integer DEFAULT 0, + initialwrite timestamp without time zone, + scratchpoolid integer DEFAULT 0, + recyclepoolid integer DEFAULT 0, + encryptionkey text, + comment text, + CONSTRAINT media_volstatus_check CHECK ((volstatus = ANY (ARRAY['Full'::text, 'Archive'::text, 'Append'::text, 'Recycle'::text, 'Purged'::text, 'Read-Only'::text, 'Disabled'::text, 'Error'::text, 'Busy'::text, 'Used'::text, 'Cleaning'::text, 'Scratch'::text]))) +); + + +-- +-- Name: media_mediaid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.media_mediaid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: media_mediaid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.media_mediaid_seq OWNED BY public.media.mediaid; + + +-- +-- Name: mediatype; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mediatype ( + mediatypeid integer NOT NULL, + mediatype text NOT NULL, + readonly integer DEFAULT 0 +); + + +-- +-- Name: mediatype_mediatypeid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.mediatype_mediatypeid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mediatype_mediatypeid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.mediatype_mediatypeid_seq OWNED BY public.mediatype.mediatypeid; + + +-- +-- Name: ndmpjobenvironment; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ndmpjobenvironment ( + jobid integer NOT NULL, + fileindex integer NOT NULL, + envname text NOT NULL, + envvalue text NOT NULL +); + + +-- +-- Name: ndmplevelmap; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ndmplevelmap ( + clientid integer NOT NULL, + filesetid integer DEFAULT 0 NOT NULL, + filesystem text NOT NULL, + dumplevel integer NOT NULL +); + + +-- +-- Name: path; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.path ( + pathid integer NOT NULL, + path text NOT NULL +); +ALTER TABLE ONLY public.path ALTER COLUMN path SET STATISTICS 1000; + + +-- +-- Name: path_pathid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.path_pathid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: path_pathid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.path_pathid_seq OWNED BY public.path.pathid; + + +-- +-- Name: pathhierarchy; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.pathhierarchy ( + pathid integer NOT NULL, + ppathid integer NOT NULL +); + + +-- +-- Name: pathvisibility; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.pathvisibility ( + pathid integer NOT NULL, + jobid integer NOT NULL, + size bigint DEFAULT 0, + files integer DEFAULT 0 +); + + +-- +-- Name: pool; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.pool ( + poolid integer NOT NULL, + name text NOT NULL, + numvols integer DEFAULT 0, + maxvols integer DEFAULT 0, + useonce smallint DEFAULT 0, + usecatalog smallint DEFAULT 0, + acceptanyvolume smallint DEFAULT 0, + volretention bigint DEFAULT 0, + voluseduration bigint DEFAULT 0, + maxvoljobs integer DEFAULT 0, + maxvolfiles integer DEFAULT 0, + maxvolbytes bigint DEFAULT 0, + autoprune smallint DEFAULT 0, + recycle smallint DEFAULT 0, + actiononpurge smallint DEFAULT 0, + pooltype text, + labeltype integer DEFAULT 0, + labelformat text NOT NULL, + enabled smallint DEFAULT 1, + scratchpoolid integer DEFAULT 0, + recyclepoolid integer DEFAULT 0, + nextpoolid integer DEFAULT 0, + minblocksize integer DEFAULT 0, + maxblocksize integer DEFAULT 0, + migrationhighbytes bigint DEFAULT 0, + migrationlowbytes bigint DEFAULT 0, + migrationtime bigint DEFAULT 0, + CONSTRAINT pool_pooltype_check CHECK ((pooltype = ANY (ARRAY['Backup'::text, 'Copy'::text, 'Cloned'::text, 'Archive'::text, 'Migration'::text, 'Scratch'::text]))) +); + + +-- +-- Name: pool_poolid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.pool_poolid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pool_poolid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.pool_poolid_seq OWNED BY public.pool.poolid; + + +-- +-- Name: quota; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.quota ( + clientid integer NOT NULL, + gracetime bigint DEFAULT 0, + quotalimit bigint DEFAULT 0 +); + + +-- +-- Name: restoreobject; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.restoreobject ( + restoreobjectid integer NOT NULL, + objectname text NOT NULL, + restoreobject bytea NOT NULL, + pluginname text NOT NULL, + objectlength integer DEFAULT 0, + objectfulllength integer DEFAULT 0, + objectindex integer DEFAULT 0, + objecttype integer DEFAULT 0, + fileindex integer DEFAULT 0, + jobid integer, + objectcompression integer DEFAULT 0 +); + + +-- +-- Name: restoreobject_restoreobjectid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.restoreobject_restoreobjectid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: restoreobject_restoreobjectid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.restoreobject_restoreobjectid_seq OWNED BY public.restoreobject.restoreobjectid; + + +-- +-- Name: status; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.status ( + jobstatus character(1) NOT NULL, + jobstatuslong text, + severity integer +); + +-- +-- Data for Name: status; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.status (jobstatus, jobstatuslong, severity) FROM stdin; +C Created, not yet running 15 +R Running 15 +B Blocked 15 +T Completed successfully 10 +E Terminated with errors 25 +e Non-fatal error 20 +f Fatal error 100 +D Verify found differences 15 +A Canceled by user 90 +I Incomplete job 15 +L Committing data 15 +W Terminated with warnings 20 +l Doing data despooling 15 +q Queued waiting for device 15 +F Waiting for Client 15 +S Waiting for Storage daemon 15 +m Waiting for new media 15 +M Waiting for media mount 15 +s Waiting for storage resource 15 +j Waiting for job resource 15 +c Waiting for client resource 15 +d Waiting on maximum jobs 15 +t Waiting on start time 15 +p Waiting on higher priority jobs 15 +a SD despooling attributes 15 +i Doing batch insert file records 15 +\. + +-- +-- Name: storage; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.storage ( + storageid integer NOT NULL, + name text NOT NULL, + autochanger integer DEFAULT 0 +); + + +-- +-- Name: storage_storageid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.storage_storageid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: storage_storageid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.storage_storageid_seq OWNED BY public.storage.storageid; + + +-- +-- Name: tapealerts; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.tapealerts ( + deviceid integer DEFAULT 0, + sampletime timestamp without time zone NOT NULL, + alertflags bigint DEFAULT 0 +); + + +-- +-- Name: unsavedfiles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.unsavedfiles ( + unsavedid integer NOT NULL, + jobid integer NOT NULL, + pathid integer NOT NULL, + filenameid integer NOT NULL +); + + +-- +-- Name: version; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.version ( + versionid integer NOT NULL +); + + +-- +-- Name: basefiles baseid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.basefiles ALTER COLUMN baseid SET DEFAULT nextval('public.basefiles_baseid_seq'::regclass); + + +-- +-- Name: client clientid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.client ALTER COLUMN clientid SET DEFAULT nextval('public.client_clientid_seq'::regclass); + + +-- +-- Name: device deviceid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device ALTER COLUMN deviceid SET DEFAULT nextval('public.device_deviceid_seq'::regclass); + + +-- +-- Name: file fileid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.file ALTER COLUMN fileid SET DEFAULT nextval('public.file_fileid_seq'::regclass); + + +-- +-- Name: filename filenameid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.filename ALTER COLUMN filenameid SET DEFAULT nextval('public.filename_filenameid_seq'::regclass); + + +-- +-- Name: fileset filesetid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.fileset ALTER COLUMN filesetid SET DEFAULT nextval('public.fileset_filesetid_seq'::regclass); + + +-- +-- Name: job jobid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.job ALTER COLUMN jobid SET DEFAULT nextval('public.job_jobid_seq'::regclass); + + +-- +-- Name: jobmedia jobmediaid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.jobmedia ALTER COLUMN jobmediaid SET DEFAULT nextval('public.jobmedia_jobmediaid_seq'::regclass); + + +-- +-- Name: location locationid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.location ALTER COLUMN locationid SET DEFAULT nextval('public.location_locationid_seq'::regclass); + + +-- +-- Name: locationlog loclogid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.locationlog ALTER COLUMN loclogid SET DEFAULT nextval('public.locationlog_loclogid_seq'::regclass); + + +-- +-- Name: log logid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.log ALTER COLUMN logid SET DEFAULT nextval('public.log_logid_seq'::regclass); + + +-- +-- Name: media mediaid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.media ALTER COLUMN mediaid SET DEFAULT nextval('public.media_mediaid_seq'::regclass); + + +-- +-- Name: mediatype mediatypeid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mediatype ALTER COLUMN mediatypeid SET DEFAULT nextval('public.mediatype_mediatypeid_seq'::regclass); + + +-- +-- Name: path pathid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.path ALTER COLUMN pathid SET DEFAULT nextval('public.path_pathid_seq'::regclass); + + +-- +-- Name: pool poolid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.pool ALTER COLUMN poolid SET DEFAULT nextval('public.pool_poolid_seq'::regclass); + + +-- +-- Name: restoreobject restoreobjectid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.restoreobject ALTER COLUMN restoreobjectid SET DEFAULT nextval('public.restoreobject_restoreobjectid_seq'::regclass); + + +-- +-- Name: storage storageid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.storage ALTER COLUMN storageid SET DEFAULT nextval('public.storage_storageid_seq'::regclass); + + +-- +-- Name: basefiles basefiles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.basefiles + ADD CONSTRAINT basefiles_pkey PRIMARY KEY (baseid); + + +-- +-- Name: client client_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.client + ADD CONSTRAINT client_pkey PRIMARY KEY (clientid); + + +-- +-- Name: counters counters_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.counters + ADD CONSTRAINT counters_pkey PRIMARY KEY (counter); + + +-- +-- Name: device device_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device + ADD CONSTRAINT device_pkey PRIMARY KEY (deviceid); + + +-- +-- Name: file file_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.file + ADD CONSTRAINT file_pkey PRIMARY KEY (fileid); + + +-- +-- Name: filename filename_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.filename + ADD CONSTRAINT filename_pkey PRIMARY KEY (filenameid); + + +-- +-- Name: fileset fileset_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.fileset + ADD CONSTRAINT fileset_pkey PRIMARY KEY (filesetid); + + +-- +-- Name: job job_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.job + ADD CONSTRAINT job_pkey PRIMARY KEY (jobid); + + +-- +-- Name: jobmedia jobmedia_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.jobmedia + ADD CONSTRAINT jobmedia_pkey PRIMARY KEY (jobmediaid); + + +-- +-- Name: location location_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.location + ADD CONSTRAINT location_pkey PRIMARY KEY (locationid); + + +-- +-- Name: locationlog locationlog_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.locationlog + ADD CONSTRAINT locationlog_pkey PRIMARY KEY (loclogid); + + +-- +-- Name: log log_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.log + ADD CONSTRAINT log_pkey PRIMARY KEY (logid); + + +-- +-- Name: media media_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.media + ADD CONSTRAINT media_pkey PRIMARY KEY (mediaid); + + +-- +-- Name: mediatype mediatype_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mediatype + ADD CONSTRAINT mediatype_pkey PRIMARY KEY (mediatypeid); + + +-- +-- Name: ndmpjobenvironment ndmpjobenvironment_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ndmpjobenvironment + ADD CONSTRAINT ndmpjobenvironment_pkey PRIMARY KEY (jobid, fileindex, envname); + + +-- +-- Name: ndmplevelmap ndmplevelmap_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ndmplevelmap + ADD CONSTRAINT ndmplevelmap_pkey PRIMARY KEY (clientid, filesetid, filesystem); + + +-- +-- Name: path path_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.path + ADD CONSTRAINT path_pkey PRIMARY KEY (pathid); + + +-- +-- Name: pathhierarchy pathhierarchy_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.pathhierarchy + ADD CONSTRAINT pathhierarchy_pkey PRIMARY KEY (pathid); + + +-- +-- Name: pathvisibility pathvisibility_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.pathvisibility + ADD CONSTRAINT pathvisibility_pkey PRIMARY KEY (jobid, pathid); + + +-- +-- Name: pool pool_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.pool + ADD CONSTRAINT pool_pkey PRIMARY KEY (poolid); + + +-- +-- Name: quota quota_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.quota + ADD CONSTRAINT quota_pkey PRIMARY KEY (clientid); + + +-- +-- Name: restoreobject restoreobject_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.restoreobject + ADD CONSTRAINT restoreobject_pkey PRIMARY KEY (restoreobjectid); + + +-- +-- Name: status status_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.status + ADD CONSTRAINT status_pkey PRIMARY KEY (jobstatus); + + +-- +-- Name: storage storage_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.storage + ADD CONSTRAINT storage_pkey PRIMARY KEY (storageid); + + +-- +-- Name: unsavedfiles unsavedfiles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.unsavedfiles + ADD CONSTRAINT unsavedfiles_pkey PRIMARY KEY (unsavedid); + + +-- +-- Name: basefiles_jobid_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX basefiles_jobid_idx ON public.basefiles USING btree (jobid); + + +-- +-- Name: client_name_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX client_name_idx ON public.client USING btree (name); + + +-- +-- Name: file_jobid_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX file_jobid_idx ON public.file USING btree (jobid); + + +-- +-- Name: file_jpfid_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX file_jpfid_idx ON public.file USING btree (jobid, pathid, filenameid); + + +-- +-- Name: filename_name_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX filename_name_idx ON public.filename USING btree (name); + + +-- +-- Name: fileset_name_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fileset_name_idx ON public.fileset USING btree (fileset); + + +-- +-- Name: job_media_job_id_media_id_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX job_media_job_id_media_id_idx ON public.jobmedia USING btree (jobid, mediaid); + + +-- +-- Name: job_name_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX job_name_idx ON public.job USING btree (name); + + +-- +-- Name: jobhisto_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX jobhisto_idx ON public.jobhisto USING btree (starttime); + + +-- +-- Name: log_name_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX log_name_idx ON public.log USING btree (jobid); + + +-- +-- Name: media_poolid_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX media_poolid_idx ON public.media USING btree (poolid); + + +-- +-- Name: media_volumename_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX media_volumename_id ON public.media USING btree (volumename); + + +-- +-- Name: path_name_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX path_name_idx ON public.path USING btree (path); + + +-- +-- Name: pathhierarchy_ppathid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX pathhierarchy_ppathid ON public.pathhierarchy USING btree (ppathid); + + +-- +-- Name: pathvisibility_jobid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX pathvisibility_jobid ON public.pathvisibility USING btree (jobid); + + +-- +-- Name: pool_name_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX pool_name_idx ON public.pool USING btree (name); + + +-- +-- Name: restore_jobid_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX restore_jobid_idx ON public.restoreobject USING btree (jobid); + + +-- +-- PostgreSQL database dump complete +-- diff --git a/development/postgres/02-testdata.sql b/development/postgres/02-testdata.sql new file mode 100644 index 0000000..17be5c4 --- /dev/null +++ b/development/postgres/02-testdata.sql @@ -0,0 +1,77 @@ +INSERT INTO public.client (name, uname) + VALUES + ('c1-fd', 'Mock client'), + ('c2-fd', 'Mock client'); + +INSERT INTO public.fileset (fileset, md5, createtime) + VALUES + ('FileSet1', 'd41d8cd98f00b204e9800998ecf8427e', NOW() - interval '2 weeks'), + ('FileSet2', 'd41d8cd98f00b204e9800998ecf8427e', NOW() - interval '2 weeks'), + ('FileSet3', 'd41d8cd98f00b204e9800998ecf8427e', NOW() - interval '2 weeks'); + +INSERT INTO public.pool (name, pooltype, labelformat) + VALUES + ('Scratch', 'Scratch', '*'), + ('Pool1', 'Backup', 'Pool1-'), + ('Pool2', 'Backup', 'Pool1-'); + +UPDATE public.pool SET + usecatalog=1, + autoprune=1, + recycle=1; + +INSERT INTO public.media (volumename, mediatype, firstwritten, lastwritten, labeldate, volstatus) + VALUES + ('Pool1-0001', 'NULL', NOW() - interval '2 weeks' + interval '30s', NOW() - interval '2 weeks' + interval '1h', NOW() - interval '2 weeks', 'Full'), + ('Pool1-0002', 'NULL', NOW() - interval '1 week 6 days' + interval '30s', NOW() - interval '1 week 6 days' + interval '1h', NOW() - interval '1 week 6 days', 'Used'), + ('Pool2-0003', 'NULL', NOW() - interval '2 weeks' + interval '30s', NOW() - interval '2 weeks' + interval '1h', NOW() - interval '2 weeks', 'Full'), + ('Pool2-0004', 'NULL', NOW() - interval '1 week 6 days' + interval '30s', NOW() - interval '1 week 6 days' + interval '1h', NOW() - interval '1 week 6 days', 'Used'), + ('Pool1-0005', 'NULL', NOW() - interval '1 week 5 days' + interval '30s', NOW() - interval '1 week 5 days' + interval '1h', NOW() - interval '1 week 5 days', 'Used'), + ('Pool2-0006', 'NULL', NOW() - interval '1 week 1 days' + interval '30s', NOW() - interval '1 week 1 days' + interval '1h', NOW() - interval '1 week 1 days', 'Used'), + ('Pool1-0007', 'NULL', NOW() - interval '1 week' + interval '30s', NOW() - interval '1 week' + interval '1h', NOW() - interval '1 week', 'Used'), + ('Pool2-0008', 'NULL', NOW() - interval '6 days' + interval '30s', NOW() - interval '6 days' + interval '1h', NOW() - interval '6 days', 'Used'), + ('Pool1-0009', 'NULL', NOW() - interval '5 days' + interval '30s', NOW() - interval '5 days' + interval '1h', NOW() - interval '5 days', 'Used'); + +UPDATE public.media m SET poolid = (select poolid from public.pool p where p.name = substring(m.volumename from '(.*)-\d+')); + +UPDATE public.media SET volretention = extract(epoch from interval '1 week'); + +INSERT INTO public.job (job, name, type, level, jobstatus, schedtime, starttime, poolid) + VALUES + ('c1-fs1.1', 'c1-fs1', 'B', 'F', 'T', NOW() - interval '2 weeks', NOW() - interval '2 weeks', (select poolid from pool WHERE name = 'Pool1')), + ('c1-fs2.1', 'c1-fs2', 'B', 'F', 'T', NOW() - interval '2 weeks', NOW() - interval '2 weeks', (select poolid from pool WHERE name = 'Pool1')), + ('c2-fs1.2', 'c2-fs1', 'B', 'F', 'T', NOW() - interval '1 week 6 days', NOW() - interval '1 week 6 days', (select poolid from pool WHERE name = 'Pool1')), + ('c2-fs1.3', 'c2-fs1', 'B', 'F', 'T', NOW() - interval '1 week 5 days', NOW() - interval '1 week 5 days', (select poolid from pool WHERE name = 'Pool2')), + ('c1-fs1.4', 'c1-fs1', 'B', 'I', 'T', NOW() - interval '1 week 5 days', NOW() - interval '1 week 5 days', (select poolid from pool WHERE name = 'Pool2')), + ('c2-fs1.5', 'c2-fs1', 'B', 'F', 'T', NOW() - interval '1 week 6 days', NOW() - interval '1 week 6 days', (select poolid from pool WHERE name = 'Pool1')), + ('c1-fs1.6', 'c2-fs1', 'B', 'F', 'T', NOW() - interval '1 week 4 days', NOW() - interval '1 week 4 days', (select poolid from pool WHERE name = 'Pool2')), + ('c1-fs1.7', 'c1-fs1', 'B', 'F', 'T', NOW() - interval '1 week 4 days', NOW() - interval '1 week 4 days', (select poolid from pool WHERE name = 'Pool1')), + ('c1-fsx.8', 'c1-fsx', 'B', 'F', 'T', NOW() - interval '4 days', NOW() - interval '4 days', (select poolid from pool WHERE name = 'Pool1')), + ('c1-fsx.9', 'c1-fsx', 'B', 'F', 'T', NOW() - interval '3 days', NOW() - interval '3 days', (select poolid from pool WHERE name = 'Pool1')); + +UPDATE public.job j SET + clientid = (SELECT c.clientid from public.client c WHERE c.name = CONCAT(substring(j.name from '([^-]+)-(.*)'), '-fd')), + filesetid = (SELECT f.filesetid from public.fileset f WHERE f.fileset = CONCAT('FileSet', substring(j.name from ('[^-]+-fs(\d+)')))), + endtime = j.starttime + interval '1h'; + +UPDATE public.job j SET + filesetid = (SELECT f.filesetid from public.fileset f WHERE f.fileset = 'FileSet2') + WHERE j.job = 'c1-fsx.8'; +UPDATE public.job j SET + filesetid = (SELECT f.filesetid from public.fileset f WHERE f.fileset = 'FileSet3') + WHERE j.job = 'c1-fsx.9'; + +INSERT INTO public.jobmedia (jobid, mediaid) + VALUES + ((select jobid from public.job where job = 'c1-fs1.1'), (select mediaid from public.media where volumename = 'Pool1-0001')), + ((select jobid from public.job where job = 'c1-fs2.1'), (select mediaid from public.media where volumename = 'Pool1-0001')), + ((select jobid from public.job where job = 'c1-fs2.1'), (select mediaid from public.media where volumename = 'Pool1-0002')), + ((select jobid from public.job where job = 'c2-fs1.2'), (select mediaid from public.media where volumename = 'Pool1-0002')), + ((select jobid from public.job where job = 'c2-fs1.3'), (select mediaid from public.media where volumename = 'Pool2-0003')), + ((select jobid from public.job where job = 'c1-fs1.4'), (select mediaid from public.media where volumename = 'Pool2-0003')), + ((select jobid from public.job where job = 'c1-fs1.4'), (select mediaid from public.media where volumename = 'Pool2-0004')), + ((select jobid from public.job where job = 'c2-fs1.5'), (select mediaid from public.media where volumename = 'Pool1-0005')), + ((select jobid from public.job where job = 'c1-fs1.6'), (select mediaid from public.media where volumename = 'Pool2-0006')), + ((select jobid from public.job where job = 'c1-fs1.6'), (select mediaid from public.media where volumename = 'Pool2-0008')), + ((select jobid from public.job where job = 'c1-fsx.8'), (select mediaid from public.media where volumename = 'Pool1-0007')), + ((select jobid from public.job where job = 'c1-fsx.9'), (select mediaid from public.media where volumename = 'Pool1-0007')); From 7ebcdb6482902355ccc54d6018400be57884c27c Mon Sep 17 00:00:00 2001 From: Lars Vierbergen Date: Tue, 20 Jul 2021 13:58:11 +0200 Subject: [PATCH 2/2] Add development setup for mysql database --- development/docker-compose.mysql.yml | 30 + ...ompose.yml => docker-compose.postgres.yml} | 0 development/mysql/01-schema.sql | 933 ++++++++++++++++++ development/mysql/02-testdata.sql | 77 ++ 4 files changed, 1040 insertions(+) create mode 100644 development/docker-compose.mysql.yml rename development/{docker-compose.yml => docker-compose.postgres.yml} (100%) create mode 100644 development/mysql/01-schema.sql create mode 100644 development/mysql/02-testdata.sql diff --git a/development/docker-compose.mysql.yml b/development/docker-compose.mysql.yml new file mode 100644 index 0000000..ab788ec --- /dev/null +++ b/development/docker-compose.mysql.yml @@ -0,0 +1,30 @@ +version: '2.2' + +services: + bareos_exporter: + ports: + - 9625 + build: + context: .. + command: + - "-dsn" + - "mysql://bareos:bareos@tcp(database:3306)/bareos?parseTime=true" + - "-job-discovery-days" + - "20" + depends_on: + - database + + database: + image: mariadb + environment: + MYSQL_RANDOM_ROOT_PASSWORD: 1 + MYSQL_DATABASE: bareos + MYSQL_USER: bareos + MYSQL_PASSWORD: bareos + + volumes: + - mysql:/var/lib/mysql + - ./mysql:/docker-entrypoint-initdb.d/:ro + +volumes: + mysql: diff --git a/development/docker-compose.yml b/development/docker-compose.postgres.yml similarity index 100% rename from development/docker-compose.yml rename to development/docker-compose.postgres.yml diff --git a/development/mysql/01-schema.sql b/development/mysql/01-schema.sql new file mode 100644 index 0000000..7309a25 --- /dev/null +++ b/development/mysql/01-schema.sql @@ -0,0 +1,933 @@ +-- MySQL dump 10.16 Distrib 10.1.48-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: bareos +-- ------------------------------------------------------ +-- Server version 10.1.48-MariaDB-0+deb9u2 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `BaseFiles` +-- + +DROP TABLE IF EXISTS `BaseFiles`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `BaseFiles` ( + `BaseId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `BaseJobId` int(10) unsigned NOT NULL, + `JobId` int(10) unsigned NOT NULL, + `FileId` bigint(20) unsigned NOT NULL, + `FileIndex` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`BaseId`), + KEY `basefiles_jobid_idx` (`JobId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `BaseFiles` +-- + +LOCK TABLES `BaseFiles` WRITE; +/*!40000 ALTER TABLE `BaseFiles` DISABLE KEYS */; +/*!40000 ALTER TABLE `BaseFiles` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Client` +-- + +DROP TABLE IF EXISTS `Client`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Client` ( + `ClientId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Name` tinyblob NOT NULL, + `Uname` tinyblob NOT NULL, + `AutoPrune` tinyint(4) DEFAULT '0', + `FileRetention` bigint(20) unsigned DEFAULT '0', + `JobRetention` bigint(20) unsigned DEFAULT '0', + PRIMARY KEY (`ClientId`), + UNIQUE KEY `Name` (`Name`(128)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Client` +-- + +LOCK TABLES `Client` WRITE; +/*!40000 ALTER TABLE `Client` DISABLE KEYS */; +/*!40000 ALTER TABLE `Client` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Counters` +-- + +DROP TABLE IF EXISTS `Counters`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Counters` ( + `Counter` tinyblob NOT NULL, + `MinValue` int(11) DEFAULT '0', + `MaxValue` int(11) DEFAULT '0', + `CurrentValue` int(11) DEFAULT '0', + `WrapCounter` tinyblob NOT NULL, + PRIMARY KEY (`Counter`(128)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Counters` +-- + +LOCK TABLES `Counters` WRITE; +/*!40000 ALTER TABLE `Counters` DISABLE KEYS */; +/*!40000 ALTER TABLE `Counters` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Device` +-- + +DROP TABLE IF EXISTS `Device`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Device` ( + `DeviceId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Name` tinyblob NOT NULL, + `MediaTypeId` int(10) unsigned DEFAULT '0', + `StorageId` int(10) unsigned DEFAULT '0', + `DevMounts` int(10) unsigned DEFAULT '0', + `DevReadBytes` bigint(20) unsigned DEFAULT '0', + `DevWriteBytes` bigint(20) unsigned DEFAULT '0', + `DevReadBytesSinceCleaning` bigint(20) unsigned DEFAULT '0', + `DevWriteBytesSinceCleaning` bigint(20) unsigned DEFAULT '0', + `DevReadTime` bigint(20) unsigned DEFAULT '0', + `DevWriteTime` bigint(20) unsigned DEFAULT '0', + `DevReadTimeSinceCleaning` bigint(20) unsigned DEFAULT '0', + `DevWriteTimeSinceCleaning` bigint(20) unsigned DEFAULT '0', + `CleaningDate` datetime DEFAULT '0000-00-00 00:00:00', + `CleaningPeriod` bigint(20) unsigned DEFAULT '0', + PRIMARY KEY (`DeviceId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Device` +-- + +LOCK TABLES `Device` WRITE; +/*!40000 ALTER TABLE `Device` DISABLE KEYS */; +/*!40000 ALTER TABLE `Device` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `DeviceStats` +-- + +DROP TABLE IF EXISTS `DeviceStats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `DeviceStats` ( + `DeviceId` int(10) unsigned DEFAULT '0', + `SampleTime` datetime NOT NULL, + `ReadTime` bigint(20) unsigned DEFAULT '0', + `WriteTime` bigint(20) unsigned DEFAULT '0', + `ReadBytes` bigint(20) unsigned DEFAULT '0', + `WriteBytes` bigint(20) unsigned DEFAULT '0', + `SpoolSize` bigint(20) unsigned DEFAULT '0', + `NumWaiting` int(11) DEFAULT '0', + `NumWriters` int(11) DEFAULT '0', + `MediaId` int(10) unsigned DEFAULT '0', + `VolCatBytes` bigint(20) unsigned DEFAULT '0', + `VolCatFiles` bigint(20) unsigned DEFAULT '0', + `VolCatBlocks` bigint(20) unsigned DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `DeviceStats` +-- + +LOCK TABLES `DeviceStats` WRITE; +/*!40000 ALTER TABLE `DeviceStats` DISABLE KEYS */; +/*!40000 ALTER TABLE `DeviceStats` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `File` +-- + +DROP TABLE IF EXISTS `File`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `File` ( + `FileId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `FileIndex` int(10) unsigned DEFAULT '0', + `JobId` int(10) unsigned NOT NULL, + `PathId` int(10) unsigned NOT NULL, + `FilenameId` int(10) unsigned NOT NULL, + `DeltaSeq` smallint(5) unsigned DEFAULT '0', + `MarkId` int(10) unsigned DEFAULT '0', + `LStat` tinyblob NOT NULL, + `MD5` tinyblob, + PRIMARY KEY (`FileId`), + KEY `JobId` (`JobId`), + KEY `JobId_2` (`JobId`,`PathId`,`FilenameId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `File` +-- + +LOCK TABLES `File` WRITE; +/*!40000 ALTER TABLE `File` DISABLE KEYS */; +/*!40000 ALTER TABLE `File` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `FileSet` +-- + +DROP TABLE IF EXISTS `FileSet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `FileSet` ( + `FileSetId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `FileSet` tinyblob NOT NULL, + `MD5` tinyblob, + `CreateTime` datetime DEFAULT '0000-00-00 00:00:00', + `FileSetText` blob NOT NULL, + PRIMARY KEY (`FileSetId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `FileSet` +-- + +LOCK TABLES `FileSet` WRITE; +/*!40000 ALTER TABLE `FileSet` DISABLE KEYS */; +/*!40000 ALTER TABLE `FileSet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Filename` +-- + +DROP TABLE IF EXISTS `Filename`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Filename` ( + `FilenameId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Name` blob NOT NULL, + PRIMARY KEY (`FilenameId`), + KEY `Name` (`Name`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Filename` +-- + +LOCK TABLES `Filename` WRITE; +/*!40000 ALTER TABLE `Filename` DISABLE KEYS */; +/*!40000 ALTER TABLE `Filename` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Job` +-- + +DROP TABLE IF EXISTS `Job`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Job` ( + `JobId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Job` tinyblob NOT NULL, + `Name` tinyblob NOT NULL, + `Type` binary(1) NOT NULL, + `Level` binary(1) NOT NULL, + `ClientId` int(11) DEFAULT '0', + `JobStatus` binary(1) NOT NULL, + `SchedTime` datetime DEFAULT '0000-00-00 00:00:00', + `StartTime` datetime DEFAULT '0000-00-00 00:00:00', + `EndTime` datetime DEFAULT '0000-00-00 00:00:00', + `RealEndTime` datetime DEFAULT '0000-00-00 00:00:00', + `JobTDate` bigint(20) unsigned DEFAULT '0', + `VolSessionId` int(10) unsigned DEFAULT '0', + `VolSessionTime` int(10) unsigned DEFAULT '0', + `JobFiles` int(10) unsigned DEFAULT '0', + `JobBytes` bigint(20) unsigned DEFAULT '0', + `ReadBytes` bigint(20) unsigned DEFAULT '0', + `JobErrors` int(10) unsigned DEFAULT '0', + `JobMissingFiles` int(10) unsigned DEFAULT '0', + `PoolId` int(10) unsigned DEFAULT '0', + `FileSetId` int(10) unsigned DEFAULT '0', + `PriorJobId` int(10) unsigned DEFAULT '0', + `PurgedFiles` tinyint(4) DEFAULT '0', + `HasBase` tinyint(4) DEFAULT '0', + `HasCache` tinyint(4) DEFAULT '0', + `Reviewed` tinyint(4) DEFAULT '0', + `Comment` blob, + PRIMARY KEY (`JobId`), + KEY `Name` (`Name`(128)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Job` +-- + +LOCK TABLES `Job` WRITE; +/*!40000 ALTER TABLE `Job` DISABLE KEYS */; +/*!40000 ALTER TABLE `Job` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `JobHisto` +-- + +DROP TABLE IF EXISTS `JobHisto`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `JobHisto` ( + `JobId` int(10) unsigned NOT NULL, + `Job` tinyblob NOT NULL, + `Name` tinyblob NOT NULL, + `Type` binary(1) NOT NULL, + `Level` binary(1) NOT NULL, + `ClientId` int(11) DEFAULT '0', + `JobStatus` binary(1) NOT NULL, + `SchedTime` datetime DEFAULT '0000-00-00 00:00:00', + `StartTime` datetime DEFAULT '0000-00-00 00:00:00', + `EndTime` datetime DEFAULT '0000-00-00 00:00:00', + `RealEndTime` datetime DEFAULT '0000-00-00 00:00:00', + `JobTDate` bigint(20) unsigned DEFAULT '0', + `VolSessionId` int(10) unsigned DEFAULT '0', + `VolSessionTime` int(10) unsigned DEFAULT '0', + `JobFiles` int(10) unsigned DEFAULT '0', + `JobBytes` bigint(20) unsigned DEFAULT '0', + `ReadBytes` bigint(20) unsigned DEFAULT '0', + `JobErrors` int(10) unsigned DEFAULT '0', + `JobMissingFiles` int(10) unsigned DEFAULT '0', + `PoolId` int(10) unsigned DEFAULT '0', + `FileSetId` int(10) unsigned DEFAULT '0', + `PriorJobId` int(10) unsigned DEFAULT '0', + `PurgedFiles` tinyint(4) DEFAULT '0', + `HasBase` tinyint(4) DEFAULT '0', + `HasCache` tinyint(4) DEFAULT '0', + `Reviewed` tinyint(4) DEFAULT '0', + `Comment` blob, + KEY `JobId` (`JobId`), + KEY `StartTime` (`StartTime`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `JobHisto` +-- + +LOCK TABLES `JobHisto` WRITE; +/*!40000 ALTER TABLE `JobHisto` DISABLE KEYS */; +/*!40000 ALTER TABLE `JobHisto` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `JobMedia` +-- + +DROP TABLE IF EXISTS `JobMedia`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `JobMedia` ( + `JobMediaId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `JobId` int(10) unsigned NOT NULL, + `MediaId` int(10) unsigned NOT NULL, + `FirstIndex` int(10) unsigned DEFAULT '0', + `LastIndex` int(10) unsigned DEFAULT '0', + `StartFile` int(10) unsigned DEFAULT '0', + `EndFile` int(10) unsigned DEFAULT '0', + `StartBlock` int(10) unsigned DEFAULT '0', + `EndBlock` int(10) unsigned DEFAULT '0', + `VolIndex` int(10) unsigned DEFAULT '0', + PRIMARY KEY (`JobMediaId`), + KEY `JobId` (`JobId`,`MediaId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `JobMedia` +-- + +LOCK TABLES `JobMedia` WRITE; +/*!40000 ALTER TABLE `JobMedia` DISABLE KEYS */; +/*!40000 ALTER TABLE `JobMedia` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `JobStats` +-- + +DROP TABLE IF EXISTS `JobStats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `JobStats` ( + `DeviceId` int(10) unsigned DEFAULT '0', + `SampleTime` datetime NOT NULL, + `JobId` int(10) unsigned NOT NULL, + `JobFiles` int(10) unsigned DEFAULT '0', + `JobBytes` bigint(20) unsigned DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `JobStats` +-- + +LOCK TABLES `JobStats` WRITE; +/*!40000 ALTER TABLE `JobStats` DISABLE KEYS */; +/*!40000 ALTER TABLE `JobStats` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Location` +-- + +DROP TABLE IF EXISTS `Location`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Location` ( + `LocationId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Location` tinyblob NOT NULL, + `Cost` int(11) DEFAULT '0', + `Enabled` tinyint(4) DEFAULT NULL, + PRIMARY KEY (`LocationId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Location` +-- + +LOCK TABLES `Location` WRITE; +/*!40000 ALTER TABLE `Location` DISABLE KEYS */; +/*!40000 ALTER TABLE `Location` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `LocationLog` +-- + +DROP TABLE IF EXISTS `LocationLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `LocationLog` ( + `LocLogId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Date` datetime DEFAULT '0000-00-00 00:00:00', + `Comment` blob NOT NULL, + `MediaId` int(10) unsigned DEFAULT '0', + `LocationId` int(10) unsigned DEFAULT '0', + `NewVolStatus` enum('Full','Archive','Append','Recycle','Purged','Read-Only','Disabled','Error','Busy','Used','Cleaning') NOT NULL, + `NewEnabled` tinyint(4) DEFAULT NULL, + PRIMARY KEY (`LocLogId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `LocationLog` +-- + +LOCK TABLES `LocationLog` WRITE; +/*!40000 ALTER TABLE `LocationLog` DISABLE KEYS */; +/*!40000 ALTER TABLE `LocationLog` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Log` +-- + +DROP TABLE IF EXISTS `Log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Log` ( + `LogId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `JobId` int(10) unsigned DEFAULT '0', + `Time` datetime DEFAULT '0000-00-00 00:00:00', + `LogText` blob NOT NULL, + PRIMARY KEY (`LogId`), + KEY `JobId` (`JobId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Log` +-- + +LOCK TABLES `Log` WRITE; +/*!40000 ALTER TABLE `Log` DISABLE KEYS */; +/*!40000 ALTER TABLE `Log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Media` +-- + +DROP TABLE IF EXISTS `Media`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Media` ( + `MediaId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `VolumeName` tinyblob NOT NULL, + `Slot` int(11) DEFAULT '0', + `PoolId` int(10) unsigned DEFAULT '0', + `MediaType` tinyblob NOT NULL, + `MediaTypeId` int(10) unsigned DEFAULT '0', + `LabelType` tinyint(4) DEFAULT '0', + `FirstWritten` datetime DEFAULT '0000-00-00 00:00:00', + `LastWritten` datetime DEFAULT '0000-00-00 00:00:00', + `LabelDate` datetime DEFAULT '0000-00-00 00:00:00', + `VolJobs` int(10) unsigned DEFAULT '0', + `VolFiles` int(10) unsigned DEFAULT '0', + `VolBlocks` int(10) unsigned DEFAULT '0', + `VolMounts` int(10) unsigned DEFAULT '0', + `VolBytes` bigint(20) unsigned DEFAULT '0', + `VolErrors` int(10) unsigned DEFAULT '0', + `VolWrites` int(10) unsigned DEFAULT '0', + `VolCapacityBytes` bigint(20) unsigned DEFAULT '0', + `VolStatus` enum('Full','Archive','Append','Recycle','Purged','Read-Only','Disabled','Error','Busy','Used','Cleaning') NOT NULL, + `Enabled` tinyint(4) DEFAULT '1', + `Recycle` tinyint(4) DEFAULT '0', + `ActionOnPurge` tinyint(4) DEFAULT '0', + `VolRetention` bigint(20) unsigned DEFAULT '0', + `VolUseDuration` bigint(20) unsigned DEFAULT '0', + `MaxVolJobs` int(10) unsigned DEFAULT '0', + `MaxVolFiles` int(10) unsigned DEFAULT '0', + `MaxVolBytes` bigint(20) unsigned DEFAULT '0', + `InChanger` tinyint(4) DEFAULT '0', + `StorageId` int(10) unsigned DEFAULT '0', + `DeviceId` int(10) unsigned DEFAULT '0', + `MediaAddressing` tinyint(4) DEFAULT '0', + `VolReadTime` bigint(20) unsigned DEFAULT '0', + `VolWriteTime` bigint(20) unsigned DEFAULT '0', + `EndFile` int(10) unsigned DEFAULT '0', + `EndBlock` int(10) unsigned DEFAULT '0', + `LocationId` int(10) unsigned DEFAULT '0', + `RecycleCount` int(10) unsigned DEFAULT '0', + `MinBlockSize` int(10) unsigned DEFAULT '0', + `MaxBlockSize` int(10) unsigned DEFAULT '0', + `InitialWrite` datetime DEFAULT '0000-00-00 00:00:00', + `ScratchPoolId` int(10) unsigned DEFAULT '0', + `RecyclePoolId` int(10) unsigned DEFAULT '0', + `EncryptionKey` tinyblob, + `Comment` blob, + PRIMARY KEY (`MediaId`), + UNIQUE KEY `VolumeName` (`VolumeName`(128)), + KEY `PoolId` (`PoolId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Media` +-- + +LOCK TABLES `Media` WRITE; +/*!40000 ALTER TABLE `Media` DISABLE KEYS */; +/*!40000 ALTER TABLE `Media` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `MediaType` +-- + +DROP TABLE IF EXISTS `MediaType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `MediaType` ( + `MediaTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `MediaType` tinyblob NOT NULL, + `ReadOnly` tinyint(4) DEFAULT '0', + PRIMARY KEY (`MediaTypeId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `MediaType` +-- + +LOCK TABLES `MediaType` WRITE; +/*!40000 ALTER TABLE `MediaType` DISABLE KEYS */; +/*!40000 ALTER TABLE `MediaType` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `NDMPJobEnvironment` +-- + +DROP TABLE IF EXISTS `NDMPJobEnvironment`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `NDMPJobEnvironment` ( + `JobId` int(10) unsigned NOT NULL, + `FileIndex` int(10) unsigned NOT NULL, + `EnvName` tinyblob NOT NULL, + `EnvValue` tinyblob NOT NULL, + PRIMARY KEY (`JobId`,`FileIndex`,`EnvName`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `NDMPJobEnvironment` +-- + +LOCK TABLES `NDMPJobEnvironment` WRITE; +/*!40000 ALTER TABLE `NDMPJobEnvironment` DISABLE KEYS */; +/*!40000 ALTER TABLE `NDMPJobEnvironment` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `NDMPLevelMap` +-- + +DROP TABLE IF EXISTS `NDMPLevelMap`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `NDMPLevelMap` ( + `ClientId` int(11) NOT NULL DEFAULT '0', + `FileSetId` int(10) unsigned NOT NULL DEFAULT '0', + `FileSystem` tinyblob NOT NULL, + `DumpLevel` int(11) NOT NULL, + PRIMARY KEY (`ClientId`,`FileSetId`,`FileSystem`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `NDMPLevelMap` +-- + +LOCK TABLES `NDMPLevelMap` WRITE; +/*!40000 ALTER TABLE `NDMPLevelMap` DISABLE KEYS */; +/*!40000 ALTER TABLE `NDMPLevelMap` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Path` +-- + +DROP TABLE IF EXISTS `Path`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Path` ( + `PathId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Path` blob NOT NULL, + PRIMARY KEY (`PathId`), + KEY `Path` (`Path`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Path` +-- + +LOCK TABLES `Path` WRITE; +/*!40000 ALTER TABLE `Path` DISABLE KEYS */; +/*!40000 ALTER TABLE `Path` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `PathHierarchy` +-- + +DROP TABLE IF EXISTS `PathHierarchy`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `PathHierarchy` ( + `PathId` int(11) NOT NULL, + `PPathId` int(11) NOT NULL, + PRIMARY KEY (`PathId`), + KEY `pathhierarchy_ppathid` (`PPathId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `PathHierarchy` +-- + +LOCK TABLES `PathHierarchy` WRITE; +/*!40000 ALTER TABLE `PathHierarchy` DISABLE KEYS */; +/*!40000 ALTER TABLE `PathHierarchy` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `PathVisibility` +-- + +DROP TABLE IF EXISTS `PathVisibility`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `PathVisibility` ( + `PathId` int(11) NOT NULL, + `JobId` int(11) NOT NULL, + `Size` bigint(20) DEFAULT '0', + `Files` int(11) DEFAULT '0', + PRIMARY KEY (`JobId`,`PathId`), + KEY `pathvisibility_jobid` (`JobId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `PathVisibility` +-- + +LOCK TABLES `PathVisibility` WRITE; +/*!40000 ALTER TABLE `PathVisibility` DISABLE KEYS */; +/*!40000 ALTER TABLE `PathVisibility` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Pool` +-- + +DROP TABLE IF EXISTS `Pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Pool` ( + `PoolId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Name` tinyblob NOT NULL, + `NumVols` int(10) unsigned DEFAULT '0', + `MaxVols` int(10) unsigned DEFAULT '0', + `UseOnce` tinyint(4) DEFAULT '0', + `UseCatalog` tinyint(4) DEFAULT '0', + `AcceptAnyVolume` tinyint(4) DEFAULT '0', + `VolRetention` bigint(20) unsigned DEFAULT '0', + `VolUseDuration` bigint(20) unsigned DEFAULT '0', + `MaxVolJobs` int(10) unsigned DEFAULT '0', + `MaxVolFiles` int(10) unsigned DEFAULT '0', + `MaxVolBytes` bigint(20) unsigned DEFAULT '0', + `AutoPrune` tinyint(4) DEFAULT '0', + `Recycle` tinyint(4) DEFAULT '0', + `ActionOnPurge` tinyint(4) DEFAULT '0', + `PoolType` enum('Backup','Copy','Cloned','Archive','Migration','Scratch') NOT NULL, + `LabelType` tinyint(4) DEFAULT '0', + `LabelFormat` tinyblob, + `Enabled` tinyint(4) DEFAULT '1', + `ScratchPoolId` int(10) unsigned DEFAULT '0', + `RecyclePoolId` int(10) unsigned DEFAULT '0', + `NextPoolId` int(10) unsigned DEFAULT '0', + `MinBlockSize` int(10) unsigned DEFAULT '0', + `MaxBlockSize` int(10) unsigned DEFAULT '0', + `MigrationHighBytes` bigint(20) unsigned DEFAULT '0', + `MigrationLowBytes` bigint(20) unsigned DEFAULT '0', + `MigrationTime` bigint(20) unsigned DEFAULT '0', + PRIMARY KEY (`PoolId`), + UNIQUE KEY `Name` (`Name`(128)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Pool` +-- + +LOCK TABLES `Pool` WRITE; +/*!40000 ALTER TABLE `Pool` DISABLE KEYS */; +/*!40000 ALTER TABLE `Pool` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Quota` +-- + +DROP TABLE IF EXISTS `Quota`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Quota` ( + `ClientId` int(11) NOT NULL DEFAULT '0', + `GraceTime` bigint(20) DEFAULT '0', + `QuotaLimit` bigint(20) unsigned DEFAULT '0', + PRIMARY KEY (`ClientId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Quota` +-- + +LOCK TABLES `Quota` WRITE; +/*!40000 ALTER TABLE `Quota` DISABLE KEYS */; +/*!40000 ALTER TABLE `Quota` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `RestoreObject` +-- + +DROP TABLE IF EXISTS `RestoreObject`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `RestoreObject` ( + `RestoreObjectId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `ObjectName` blob NOT NULL, + `RestoreObject` longblob NOT NULL, + `PluginName` tinyblob NOT NULL, + `ObjectLength` int(11) DEFAULT '0', + `ObjectFullLength` int(11) DEFAULT '0', + `ObjectIndex` int(11) DEFAULT '0', + `ObjectType` int(11) DEFAULT '0', + `FileIndex` int(10) unsigned DEFAULT '0', + `JobId` int(10) unsigned NOT NULL, + `ObjectCompression` int(11) DEFAULT '0', + PRIMARY KEY (`RestoreObjectId`), + KEY `JobId` (`JobId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `RestoreObject` +-- + +LOCK TABLES `RestoreObject` WRITE; +/*!40000 ALTER TABLE `RestoreObject` DISABLE KEYS */; +/*!40000 ALTER TABLE `RestoreObject` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Status` +-- + +DROP TABLE IF EXISTS `Status`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Status` ( + `JobStatus` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, + `JobStatusLong` blob, + `Severity` int(11) DEFAULT NULL, + PRIMARY KEY (`JobStatus`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Status` +-- + +LOCK TABLES `Status` WRITE; +/*!40000 ALTER TABLE `Status` DISABLE KEYS */; +INSERT INTO `Status` VALUES ('A','Canceled by user',90),('B','Blocked',15),('C','Created, not yet running',15),('D','Verify found differences',15),('E','Terminated with errors',25),('F','Waiting for Client',15),('I','Incomplete job',15),('L','Committing data',15),('M','Waiting for media mount',15),('R','Running',15),('S','Waiting for Storage daemon',15),('T','Completed successfully',10),('W','Terminated with warnings',20),('a','SD despooling attributes',15),('c','Waiting for client resource',15),('d','Waiting on maximum jobs',15),('e','Non-fatal error',20),('f','Fatal error',100),('i','Doing batch insert file records',15),('j','Waiting for job resource',15),('l','Doing data despooling',15),('m','Waiting for new media',15),('p','Waiting on higher priority jobs',15),('q','Queued waiting for device',15),('s','Waiting for storage resource',15),('t','Waiting on start time',15); +/*!40000 ALTER TABLE `Status` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Storage` +-- + +DROP TABLE IF EXISTS `Storage`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Storage` ( + `StorageId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Name` tinyblob NOT NULL, + `AutoChanger` tinyint(4) DEFAULT '0', + PRIMARY KEY (`StorageId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Storage` +-- + +LOCK TABLES `Storage` WRITE; +/*!40000 ALTER TABLE `Storage` DISABLE KEYS */; +/*!40000 ALTER TABLE `Storage` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `TapeAlerts` +-- + +DROP TABLE IF EXISTS `TapeAlerts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `TapeAlerts` ( + `DeviceId` int(10) unsigned DEFAULT '0', + `SampleTime` datetime NOT NULL, + `AlertFlags` bigint(20) unsigned DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `TapeAlerts` +-- + +LOCK TABLES `TapeAlerts` WRITE; +/*!40000 ALTER TABLE `TapeAlerts` DISABLE KEYS */; +/*!40000 ALTER TABLE `TapeAlerts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `UnsavedFiles` +-- + +DROP TABLE IF EXISTS `UnsavedFiles`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `UnsavedFiles` ( + `UnsavedId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `JobId` int(10) unsigned NOT NULL, + `PathId` int(10) unsigned NOT NULL, + `FilenameId` int(10) unsigned NOT NULL, + PRIMARY KEY (`UnsavedId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `UnsavedFiles` +-- + +LOCK TABLES `UnsavedFiles` WRITE; +/*!40000 ALTER TABLE `UnsavedFiles` DISABLE KEYS */; +/*!40000 ALTER TABLE `UnsavedFiles` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `Version` +-- + +DROP TABLE IF EXISTS `Version`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Version` ( + `VersionId` int(10) unsigned NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `Version` +-- + +LOCK TABLES `Version` WRITE; +/*!40000 ALTER TABLE `Version` DISABLE KEYS */; +INSERT INTO `Version` VALUES (2004); +/*!40000 ALTER TABLE `Version` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-07-20 10:42:51 diff --git a/development/mysql/02-testdata.sql b/development/mysql/02-testdata.sql new file mode 100644 index 0000000..43ee4b6 --- /dev/null +++ b/development/mysql/02-testdata.sql @@ -0,0 +1,77 @@ +INSERT INTO Client (Name, Uname) + VALUES + ('c1-fd', 'Mock client'), + ('c2-fd', 'Mock client'); + +INSERT INTO FileSet (FileSet, MD5, CreateTime, FileSetText) + VALUES + ('FileSet1', 'd41d8cd98f00b204e9800998ecf8427e', NOW() - INTERVAL 2 WEEK, ''), + ('FileSet2', 'd41d8cd98f00b204e9800998ecf8427e', NOW() - INTERVAL 2 WEEK, ''), + ('FileSet3', 'd41d8cd98f00b204e9800998ecf8427e', NOW() - INTERVAL 2 WEEK, ''); + +INSERT INTO Pool (Name, PoolType, LabelFormat) + VALUES + ('Scratch', 'Scratch', '*'), + ('Pool1', 'Backup', 'Pool1-'), + ('Pool2', 'Backup', 'Pool1-'); + +UPDATE Pool SET + UseCatalog=1, + AutoPrune=1, + Recycle=1; + +INSERT INTO Media (volumename, mediatype, firstwritten, lastwritten, labeldate, volstatus) + VALUES + ('Pool1-0001', 'NULL', NOW() - interval 2 week + interval 30 second, NOW() - interval 2 week + interval 1 hour, NOW() - interval 2 week, 'Full'), + ('Pool1-0002', 'NULL', NOW() - interval 13 day + interval 30 second, NOW() - interval 13 day + interval 1 hour, NOW() - interval 13 day, 'Used'), + ('Pool2-0003', 'NULL', NOW() - interval 2 week + interval 30 second, NOW() - interval 2 week + interval 1 hour, NOW() - interval 2 week, 'Full'), + ('Pool2-0004', 'NULL', NOW() - interval 13 day + interval 30 second, NOW() - interval 13 day + interval 1 hour, NOW() - interval 13 day, 'Used'), + ('Pool1-0005', 'NULL', NOW() - interval 12 day + interval 30 second, NOW() - interval 12 day + interval 1 hour, NOW() - interval 12 day, 'Used'), + ('Pool2-0006', 'NULL', NOW() - interval 8 day + interval 30 second, NOW() - interval 8 day + interval 1 hour, NOW() - interval 8 day, 'Used'), + ('Pool1-0007', 'NULL', NOW() - interval 7 day + interval 30 second, NOW() - interval 7 day + interval 1 hour, NOW() - interval 7 day, 'Used'), + ('Pool2-0008', 'NULL', NOW() - interval 6 day + interval 30 second, NOW() - interval 6 day + interval 1 hour, NOW() - interval 6 day, 'Used'), + ('Pool1-0009', 'NULL', NOW() - interval 5 day + interval 30 second, NOW() - interval 5 day + interval 1 hour, NOW() - interval 5 day, 'Used'); + +UPDATE Media m SET poolid = (select poolid from Pool p where p.name = substring(m.volumename from 1 for 5)); + +UPDATE Media SET volretention = 604800; -- 1 week + +INSERT INTO Job (job, name, type, level, jobstatus, schedtime, starttime, poolid) + VALUES + ('c1-fs1.1', 'c1-fs1', 'B', 'F', 'T', NOW() - interval 2 week, NOW() - interval 2 week, (select poolid from Pool WHERE name = 'Pool1')), + ('c1-fs2.1', 'c1-fs2', 'B', 'F', 'T', NOW() - interval 2 week, NOW() - interval 2 week, (select poolid from Pool WHERE name = 'Pool1')), + ('c2-fs1.2', 'c2-fs1', 'B', 'F', 'T', NOW() - interval 13 day, NOW() - interval 13 day, (select poolid from Pool WHERE name = 'Pool1')), + ('c2-fs1.3', 'c2-fs1', 'B', 'F', 'T', NOW() - interval 12 day, NOW() - interval 12 day, (select poolid from Pool WHERE name = 'Pool2')), + ('c1-fs1.4', 'c1-fs1', 'B', 'I', 'T', NOW() - interval 12 day, NOW() - interval 12 day, (select poolid from Pool WHERE name = 'Pool2')), + ('c2-fs1.5', 'c2-fs1', 'B', 'F', 'T', NOW() - interval 13 day, NOW() - interval 13 day, (select poolid from Pool WHERE name = 'Pool1')), + ('c1-fs1.6', 'c2-fs1', 'B', 'F', 'T', NOW() - interval 11 day, NOW() - interval 11 day, (select poolid from Pool WHERE name = 'Pool2')), + ('c1-fs1.7', 'c1-fs1', 'B', 'F', 'T', NOW() - interval 11 day, NOW() - interval 11 day, (select poolid from Pool WHERE name = 'Pool1')), + ('c1-fsx.8', 'c1-fsx', 'B', 'F', 'T', NOW() - interval 4 day, NOW() - interval 4 day, (select poolid from Pool WHERE name = 'Pool1')), + ('c1-fsx.9', 'c1-fsx', 'B', 'F', 'T', NOW() - interval 3 day, NOW() - interval 3 day, (select poolid from Pool WHERE name = 'Pool1')); + +UPDATE Job j SET + clientid = (SELECT c.clientid from Client c WHERE c.name = CONCAT(substring(j.name from 1 for 2), '-fd')), + filesetid = (SELECT f.filesetid from FileSet f WHERE f.fileset = CONCAT('FileSet', substring(j.name from 6))), + endtime = j.starttime + interval 1 hour; + +UPDATE Job j SET + filesetid = (SELECT f.filesetid from FileSet f WHERE f.fileset = 'FileSet2') + WHERE j.job = 'c1-fsx.8'; +UPDATE Job j SET + filesetid = (SELECT f.filesetid from FileSet f WHERE f.fileset = 'FileSet3') + WHERE j.job = 'c1-fsx.9'; + +INSERT INTO JobMedia (jobid, mediaid) + VALUES + ((select jobid from Job where job = 'c1-fs1.1'), (select mediaid from Media where volumename = 'Pool1-0001')), + ((select jobid from Job where job = 'c1-fs2.1'), (select mediaid from Media where volumename = 'Pool1-0001')), + ((select jobid from Job where job = 'c1-fs2.1'), (select mediaid from Media where volumename = 'Pool1-0002')), + ((select jobid from Job where job = 'c2-fs1.2'), (select mediaid from Media where volumename = 'Pool1-0002')), + ((select jobid from Job where job = 'c2-fs1.3'), (select mediaid from Media where volumename = 'Pool2-0003')), + ((select jobid from Job where job = 'c1-fs1.4'), (select mediaid from Media where volumename = 'Pool2-0003')), + ((select jobid from Job where job = 'c1-fs1.4'), (select mediaid from Media where volumename = 'Pool2-0004')), + ((select jobid from Job where job = 'c2-fs1.5'), (select mediaid from Media where volumename = 'Pool1-0005')), + ((select jobid from Job where job = 'c1-fs1.6'), (select mediaid from Media where volumename = 'Pool2-0006')), + ((select jobid from Job where job = 'c1-fs1.6'), (select mediaid from Media where volumename = 'Pool2-0008')), + ((select jobid from Job where job = 'c1-fsx.8'), (select mediaid from Media where volumename = 'Pool1-0007')), + ((select jobid from Job where job = 'c1-fsx.9'), (select mediaid from Media where volumename = 'Pool1-0007'));