--
-- PostgreSQL database dump
--


--
-- TOC entry 10 (class 2615 OID 9816969)
-- Name: vmreports; Type: SCHEMA; Schema: -; Owner: dbo
--

CREATE SCHEMA IF NOT EXISTS vmreports;
ALTER SCHEMA vmreports OWNER TO dbo;
GRANT USAGE ON SCHEMA vmreports TO nifi,appserver;
ALTER DEFAULT PRIVILEGES FOR ROLE dbo IN SCHEMA vmreports GRANT SELECT ON TABLES TO appserver;
ALTER DEFAULT PRIVILEGES FOR ROLE dbo IN SCHEMA vmreports GRANT ALL ON TABLES TO nifi;
ALTER DEFAULT PRIVILEGES FOR ROLE dbo IN SCHEMA vmreports GRANT USAGE ON SEQUENCES TO nifi, appserver;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- TOC entry 721 (class 1259 OID 9816992)
-- Name: compute; Type: TABLE; Schema: vmreports; Owner: smishchuk
--

CREATE TABLE vmreports.compute (
    "Name" character varying(255),
    "UUID_VM" character varying(255),
    "VDC" character varying(255),
    "Organization_UUID" uuid,
    "Organization" character varying(255),
    "WZ" character varying(255),
    "Cluster" character varying(255),
    "Host" character varying(255),
    "Host_Model" character varying(255),
    "CPU_Model" character varying(255),
    "Host_CPU_Cores" double precision,
    "Host_CPU_Sockets" double precision,
    "Host_CPU_Speed" double precision,
    "Host_RAM" double precision,
    "Host_CPU_Used" double precision,
    "Host_CPU_Used_Avg" double precision,
    "VDC_CPU_Reserv" double precision,
    "VDC_CPU_Speed" double precision,
    "VM_vCPU_count" double precision,
    "VM_CPU_Used" double precision,
    "VM_CPU_Used_AVG" double precision,
    "VM_CPU_Reserv_GHz" double precision,
    "VM_CPU_Reserv_perc" double precision,
    "VM_RAM_Allocated" double precision,
    "VM_RAM_Used" double precision,
    "VM_is_ON" double precision,
    "Object_UUID" uuid NOT NULL,
    ts timestamp with time zone NOT NULL
);


ALTER TABLE vmreports.compute OWNER TO dbo;

--
-- TOC entry 722 (class 1259 OID 9817004)
-- Name: storage; Type: TABLE; Schema: vmreports; Owner: smishchuk
--

CREATE TABLE vmreports.storage (
    "Name" character varying(255),
    "VM_UUID" character varying(255),
    "VDC" character varying(255),
    "Organization_UUID" uuid,
    "Organization" character varying(255),
    "WZ" character varying(255),
    "Cluster" character varying(255),
    "Disk" character varying(255),
    "Storage_Policy" character varying(255),
    "Disk_Allocated" double precision,
    "Disk_Used" double precision,
    "VM_is_ON" double precision,
    "Object_UUID" uuid NOT NULL,
    ts timestamp with time zone NOT NULL
);


ALTER TABLE vmreports.storage OWNER TO dbo;

--
-- TOC entry 720 (class 1259 OID 9816984)
-- Name: host; Type: TABLE; Schema: vmreports; Owner: smishchuk
--

CREATE TABLE vmreports.host (
    "Name" character varying(255),
    "Model" character varying(255),
    "Cluster" character varying(255),
    "Maintenance" character varying(255),
    "CPU_Cores" double precision,
    "CPU_Sockets" double precision,
    "CPU_Speed" double precision,
    "RAM_Total" double precision,
    "RAM_Used" double precision,
    "CPU_Used" double precision,
    "CPU_Used_AVG" double precision,
    "CPU_Contention_95" double precision,
    "Object_UUID" uuid NOT NULL,
    ts timestamp with time zone NOT NULL,
    "Cluster_v2" character varying(255),
    "HT_Active" boolean,
    "CPUtoVM" double precision,
    "RAMtoVM" double precision
);


ALTER TABLE vmreports.host OWNER TO dbo;

--
-- TOC entry 733 (class 1259 OID 11093092)
-- Name: vm_gpu; Type: TABLE; Schema: vmreports; Owner: smishchuk
--

CREATE TABLE vmreports.vm_gpu (
    "Name" character varying(255),
    "ClientID" character varying(255),
    "VCD" character varying(255),
    "Org" character varying(255),
    "OrgVDC" character varying(255),
    "vCenter" character varying(255),
    "GPU" jsonb,
    "OrgStatus" character varying(255),
    "Object_UUID" uuid NOT NULL,
    ts timestamp with time zone NOT NULL
);


ALTER TABLE vmreports.vm_gpu OWNER TO dbo;

--
-- TOC entry 732 (class 1259 OID 11093087)
-- Name: vm_power_state; Type: TABLE; Schema: vmreports; Owner: smishchuk
--

CREATE TABLE vmreports.vm_power_state (
    "Object_UUID" uuid NOT NULL,
    ts timestamp with time zone NOT NULL,
    value double precision
);


ALTER TABLE vmreports.vm_power_state OWNER TO dbo;

--
-- TOC entry 4761 (class 2606 OID 9816998)
-- Name: compute pk_compute; Type: CONSTRAINT; Schema: vmreports; Owner: smishchuk
--

ALTER TABLE ONLY vmreports.compute
    ADD CONSTRAINT pk_compute PRIMARY KEY (ts, "Object_UUID");


--
-- TOC entry 4759 (class 2606 OID 9816990)
-- Name: host pk_host; Type: CONSTRAINT; Schema: vmreports; Owner: smishchuk
--

ALTER TABLE ONLY vmreports.host
    ADD CONSTRAINT pk_host PRIMARY KEY (ts, "Object_UUID");


--
-- TOC entry 4763 (class 2606 OID 9817010)
-- Name: storage pk_storage; Type: CONSTRAINT; Schema: vmreports; Owner: smishchuk
--

ALTER TABLE ONLY vmreports.storage
    ADD CONSTRAINT pk_storage PRIMARY KEY (ts, "Object_UUID");


--
-- TOC entry 4767 (class 2606 OID 11093098)
-- Name: vm_gpu pk_vm_gpu; Type: CONSTRAINT; Schema: vmreports; Owner: smishchuk
--

ALTER TABLE ONLY vmreports.vm_gpu
    ADD CONSTRAINT pk_vm_gpu PRIMARY KEY (ts, "Object_UUID");


--
-- TOC entry 4765 (class 2606 OID 11093091)
-- Name: vm_power_state pk_vm_power_state; Type: CONSTRAINT; Schema: vmreports; Owner: smishchuk
--

ALTER TABLE ONLY vmreports.vm_power_state
    ADD CONSTRAINT pk_vm_power_state PRIMARY KEY ("Object_UUID", ts);


--
-- TOC entry 5168 (class 0 OID 0)
-- Dependencies: 10
-- Name: SCHEMA vmreports; Type: ACL; Schema: -; Owner: dbo
--

GRANT ALL ON SCHEMA vmreports TO nifi;



