|
|
@@ -1,12 +1,850 @@
|
|
|
+--
|
|
|
+-- PostgreSQL database dump
|
|
|
+--
|
|
|
|
|
|
-CREATE DATABASE telemetry;
|
|
|
-CREATE EXTENSION IF NOT EXISTS timescaledb;
|
|
|
+-- Dumped from database version 11.12
|
|
|
+-- Dumped by pg_dump version 15.2
|
|
|
|
|
|
-\connect telemetry
|
|
|
+-- Started on 2023-05-05 01:10:04
|
|
|
|
|
|
+SET statement_timeout = 0;
|
|
|
+SET lock_timeout = 0;
|
|
|
+SET idle_in_transaction_session_timeout = 0;
|
|
|
+SET client_encoding = 'UTF8';
|
|
|
+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;
|
|
|
|
|
|
-CREATE TABLE IF NOT EXISTS post(
|
|
|
- id serial PRIMARY KEY,
|
|
|
- text VARCHAR (255) NOT NULL,
|
|
|
- created_on TIMESTAMP NOT NULL DEFAULT NOW()
|
|
|
+
|
|
|
+CREATE ROLE senslog NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT;
|
|
|
+CREATE ROLE maplog_app NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN PASSWORD 'MAPlog';
|
|
|
+GRANT senslog TO maplog_app;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3861 (class 1262 OID 54507)
|
|
|
+-- Name: maplog; Type: DATABASE; Schema: -; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+CREATE DATABASE maplog WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.UTF-8';
|
|
|
+
|
|
|
+
|
|
|
+ALTER DATABASE maplog OWNER TO senslog;
|
|
|
+
|
|
|
+\connect maplog
|
|
|
+
|
|
|
+SET statement_timeout = 0;
|
|
|
+SET lock_timeout = 0;
|
|
|
+SET idle_in_transaction_session_timeout = 0;
|
|
|
+SET client_encoding = 'UTF8';
|
|
|
+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;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 9 (class 2615 OID 55528)
|
|
|
+-- Name: maplog; Type: SCHEMA; Schema: -; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE SCHEMA maplog;
|
|
|
+
|
|
|
+
|
|
|
+ALTER SCHEMA maplog OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 7 (class 2615 OID 2200)
|
|
|
+-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+-- *not* creating schema, since initdb creates it
|
|
|
+
|
|
|
+
|
|
|
+ALTER SCHEMA public OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 2 (class 3079 OID 54508)
|
|
|
+-- Name: postgis; Type: EXTENSION; Schema: -; Owner: -
|
|
|
+--
|
|
|
+
|
|
|
+CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3863 (class 0 OID 0)
|
|
|
+-- Dependencies: 2
|
|
|
+-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner:
|
|
|
+--
|
|
|
+
|
|
|
+COMMENT ON EXTENSION postgis IS 'PostGIS geometry and geography spatial types and functions';
|
|
|
+
|
|
|
+
|
|
|
+SET default_tablespace = '';
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 216 (class 1259 OID 62701)
|
|
|
+-- Name: campaign; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.campaign (
|
|
|
+ campaign_id integer NOT NULL,
|
|
|
+ description text NOT NULL,
|
|
|
+ from_time timestamp with time zone NOT NULL,
|
|
|
+ to_time timestamp with time zone NOT NULL
|
|
|
);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.campaign OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 215 (class 1259 OID 62699)
|
|
|
+-- Name: campaign_campaign_id_seq; Type: SEQUENCE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE SEQUENCE maplog.campaign_campaign_id_seq
|
|
|
+ AS integer
|
|
|
+ START WITH 1
|
|
|
+ INCREMENT BY 1
|
|
|
+ NO MINVALUE
|
|
|
+ NO MAXVALUE
|
|
|
+ CACHE 1;
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.campaign_campaign_id_seq OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3864 (class 0 OID 0)
|
|
|
+-- Dependencies: 215
|
|
|
+-- Name: campaign_campaign_id_seq; Type: SEQUENCE OWNED BY; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER SEQUENCE maplog.campaign_campaign_id_seq OWNED BY maplog.campaign.campaign_id;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 224 (class 1259 OID 62784)
|
|
|
+-- Name: groups; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.groups (
|
|
|
+ group_id integer NOT NULL,
|
|
|
+ group_name text,
|
|
|
+ parent_group_id integer,
|
|
|
+ has_children boolean DEFAULT false
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.groups OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 223 (class 1259 OID 62782)
|
|
|
+-- Name: group_group_id_seq; Type: SEQUENCE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE SEQUENCE maplog.group_group_id_seq
|
|
|
+ AS integer
|
|
|
+ START WITH 1
|
|
|
+ INCREMENT BY 1
|
|
|
+ NO MINVALUE
|
|
|
+ NO MAXVALUE
|
|
|
+ CACHE 1;
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.group_group_id_seq OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3865 (class 0 OID 0)
|
|
|
+-- Dependencies: 223
|
|
|
+-- Name: group_group_id_seq; Type: SEQUENCE OWNED BY; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER SEQUENCE maplog.group_group_id_seq OWNED BY maplog.groups.group_id;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 212 (class 1259 OID 55614)
|
|
|
+-- Name: obs_telemetry; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.obs_telemetry (
|
|
|
+ obs_id bigint NOT NULL,
|
|
|
+ time_stamp timestamp with time zone NOT NULL,
|
|
|
+ unit_id bigint NOT NULL,
|
|
|
+ observed_values jsonb NOT NULL,
|
|
|
+ the_geom public.geometry(Point,4326),
|
|
|
+ time_received timestamp with time zone DEFAULT now() NOT NULL
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.obs_telemetry OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 211 (class 1259 OID 55612)
|
|
|
+-- Name: obs_telemetry_obs_id_seq; Type: SEQUENCE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE SEQUENCE maplog.obs_telemetry_obs_id_seq
|
|
|
+ START WITH 1
|
|
|
+ INCREMENT BY 1
|
|
|
+ NO MINVALUE
|
|
|
+ NO MAXVALUE
|
|
|
+ CACHE 1;
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.obs_telemetry_obs_id_seq OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3866 (class 0 OID 0)
|
|
|
+-- Dependencies: 211
|
|
|
+-- Name: obs_telemetry_obs_id_seq; Type: SEQUENCE OWNED BY; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER SEQUENCE maplog.obs_telemetry_obs_id_seq OWNED BY maplog.obs_telemetry.obs_id;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 209 (class 1259 OID 55579)
|
|
|
+-- Name: phenomenon; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.phenomenon (
|
|
|
+ phenomenon_id integer NOT NULL,
|
|
|
+ phenomenon_name text NOT NULL,
|
|
|
+ uom character varying(30) NOT NULL,
|
|
|
+ uom_link text
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.phenomenon OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 208 (class 1259 OID 55577)
|
|
|
+-- Name: phenomenon_phenomenon_id_seq; Type: SEQUENCE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE SEQUENCE maplog.phenomenon_phenomenon_id_seq
|
|
|
+ AS integer
|
|
|
+ START WITH 1
|
|
|
+ INCREMENT BY 1
|
|
|
+ NO MINVALUE
|
|
|
+ NO MAXVALUE
|
|
|
+ CACHE 1;
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.phenomenon_phenomenon_id_seq OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3867 (class 0 OID 0)
|
|
|
+-- Dependencies: 208
|
|
|
+-- Name: phenomenon_phenomenon_id_seq; Type: SEQUENCE OWNED BY; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER SEQUENCE maplog.phenomenon_phenomenon_id_seq OWNED BY maplog.phenomenon.phenomenon_id;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 207 (class 1259 OID 55566)
|
|
|
+-- Name: sensor; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.sensor (
|
|
|
+ sensor_id bigint NOT NULL,
|
|
|
+ sensor_name character varying(100),
|
|
|
+ sensor_type text,
|
|
|
+ sensor_type_id integer,
|
|
|
+ min_range text,
|
|
|
+ max_range text,
|
|
|
+ phenomenon_id integer NOT NULL
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.sensor OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 206 (class 1259 OID 55564)
|
|
|
+-- Name: sensor_sensor_id_seq; Type: SEQUENCE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE SEQUENCE maplog.sensor_sensor_id_seq
|
|
|
+ START WITH 1
|
|
|
+ INCREMENT BY 1
|
|
|
+ NO MINVALUE
|
|
|
+ NO MAXVALUE
|
|
|
+ CACHE 1;
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.sensor_sensor_id_seq OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3868 (class 0 OID 0)
|
|
|
+-- Dependencies: 206
|
|
|
+-- Name: sensor_sensor_id_seq; Type: SEQUENCE OWNED BY; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER SEQUENCE maplog.sensor_sensor_id_seq OWNED BY maplog.sensor.sensor_id;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 213 (class 1259 OID 55644)
|
|
|
+-- Name: system_user; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.system_user (
|
|
|
+ user_id integer NOT NULL,
|
|
|
+ user_name text NOT NULL,
|
|
|
+ user_real_name text,
|
|
|
+ user_password text,
|
|
|
+ group_id integer,
|
|
|
+ rights_id integer DEFAULT 0
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.system_user OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 204 (class 1259 OID 55540)
|
|
|
+-- Name: unit; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.unit (
|
|
|
+ unit_id bigint NOT NULL,
|
|
|
+ imei character varying(20) NOT NULL,
|
|
|
+ description text,
|
|
|
+ is_mobile boolean DEFAULT true NOT NULL,
|
|
|
+ unit_type_id character varying(2) DEFAULT 'X'::character varying NOT NULL
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.unit OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 218 (class 1259 OID 62712)
|
|
|
+-- Name: unit_to_campaign; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.unit_to_campaign (
|
|
|
+ id integer NOT NULL,
|
|
|
+ camp_id integer NOT NULL,
|
|
|
+ unit_id bigint NOT NULL,
|
|
|
+ from_time timestamp with time zone NOT NULL,
|
|
|
+ to_time timestamp with time zone NOT NULL
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.unit_to_campaign OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 217 (class 1259 OID 62710)
|
|
|
+-- Name: unit_to_campaign_id_seq; Type: SEQUENCE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE SEQUENCE maplog.unit_to_campaign_id_seq
|
|
|
+ AS integer
|
|
|
+ START WITH 1
|
|
|
+ INCREMENT BY 1
|
|
|
+ NO MINVALUE
|
|
|
+ NO MAXVALUE
|
|
|
+ CACHE 1;
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.unit_to_campaign_id_seq OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3869 (class 0 OID 0)
|
|
|
+-- Dependencies: 217
|
|
|
+-- Name: unit_to_campaign_id_seq; Type: SEQUENCE OWNED BY; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER SEQUENCE maplog.unit_to_campaign_id_seq OWNED BY maplog.unit_to_campaign.id;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 226 (class 1259 OID 62796)
|
|
|
+-- Name: unit_to_group; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.unit_to_group (
|
|
|
+ id integer NOT NULL,
|
|
|
+ group_id integer,
|
|
|
+ unit_id bigint
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.unit_to_group OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 225 (class 1259 OID 62794)
|
|
|
+-- Name: unit_to_group_id_seq; Type: SEQUENCE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE SEQUENCE maplog.unit_to_group_id_seq
|
|
|
+ AS integer
|
|
|
+ START WITH 1
|
|
|
+ INCREMENT BY 1
|
|
|
+ NO MINVALUE
|
|
|
+ NO MAXVALUE
|
|
|
+ CACHE 1;
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.unit_to_group_id_seq OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3870 (class 0 OID 0)
|
|
|
+-- Dependencies: 225
|
|
|
+-- Name: unit_to_group_id_seq; Type: SEQUENCE OWNED BY; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER SEQUENCE maplog.unit_to_group_id_seq OWNED BY maplog.unit_to_group.id;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 210 (class 1259 OID 55594)
|
|
|
+-- Name: unit_to_sensor; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.unit_to_sensor (
|
|
|
+ sensor_id bigint NOT NULL,
|
|
|
+ unit_id bigint NOT NULL,
|
|
|
+ first_obs_ts timestamp with time zone,
|
|
|
+ last_obs_ts timestamp with time zone,
|
|
|
+ last_obs_value double precision DEFAULT 'NaN'::double precision
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.unit_to_sensor OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 205 (class 1259 OID 55548)
|
|
|
+-- Name: unit_type; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.unit_type (
|
|
|
+ unit_type_id character varying(2) NOT NULL,
|
|
|
+ type_name character varying(20) NOT NULL,
|
|
|
+ description text
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.unit_type OWNER TO senslog;
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 214 (class 1259 OID 55654)
|
|
|
+-- Name: user_to_campaign; Type: TABLE; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE TABLE maplog.user_to_campaign (
|
|
|
+ user_id integer NOT NULL,
|
|
|
+ campaign_id integer NOT NULL
|
|
|
+);
|
|
|
+
|
|
|
+
|
|
|
+ALTER TABLE maplog.user_to_campaign OWNER TO senslog;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3638 (class 2604 OID 62704)
|
|
|
+-- Name: campaign campaign_id; Type: DEFAULT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.campaign ALTER COLUMN campaign_id SET DEFAULT nextval('maplog.campaign_campaign_id_seq'::regclass);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3643 (class 2604 OID 62787)
|
|
|
+-- Name: groups group_id; Type: DEFAULT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.groups ALTER COLUMN group_id SET DEFAULT nextval('maplog.group_group_id_seq'::regclass);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3635 (class 2604 OID 55617)
|
|
|
+-- Name: obs_telemetry obs_id; Type: DEFAULT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.obs_telemetry ALTER COLUMN obs_id SET DEFAULT nextval('maplog.obs_telemetry_obs_id_seq'::regclass);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3633 (class 2604 OID 55582)
|
|
|
+-- Name: phenomenon phenomenon_id; Type: DEFAULT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.phenomenon ALTER COLUMN phenomenon_id SET DEFAULT nextval('maplog.phenomenon_phenomenon_id_seq'::regclass);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3632 (class 2604 OID 55569)
|
|
|
+-- Name: sensor sensor_id; Type: DEFAULT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.sensor ALTER COLUMN sensor_id SET DEFAULT nextval('maplog.sensor_sensor_id_seq'::regclass);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3639 (class 2604 OID 62715)
|
|
|
+-- Name: unit_to_campaign id; Type: DEFAULT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_campaign ALTER COLUMN id SET DEFAULT nextval('maplog.unit_to_campaign_id_seq'::regclass);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3645 (class 2604 OID 62799)
|
|
|
+-- Name: unit_to_group id; Type: DEFAULT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_group ALTER COLUMN id SET DEFAULT nextval('maplog.unit_to_group_id_seq'::regclass);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3677 (class 2606 OID 62709)
|
|
|
+-- Name: campaign campaign_pkey; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.campaign
|
|
|
+ ADD CONSTRAINT campaign_pkey PRIMARY KEY (campaign_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3689 (class 2606 OID 62793)
|
|
|
+-- Name: groups group_pkey; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.groups
|
|
|
+ ADD CONSTRAINT group_pkey PRIMARY KEY (group_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3667 (class 2606 OID 55623)
|
|
|
+-- Name: obs_telemetry obs_telemetry_pkey; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.obs_telemetry
|
|
|
+ ADD CONSTRAINT obs_telemetry_pkey PRIMARY KEY (obs_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3660 (class 2606 OID 55587)
|
|
|
+-- Name: phenomenon phenomenon_pkey; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.phenomenon
|
|
|
+ ADD CONSTRAINT phenomenon_pkey PRIMARY KEY (phenomenon_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3656 (class 2606 OID 55574)
|
|
|
+-- Name: sensor sensor_pkey; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.sensor
|
|
|
+ ADD CONSTRAINT sensor_pkey PRIMARY KEY (sensor_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3658 (class 2606 OID 55576)
|
|
|
+-- Name: sensor sensor_sensor_name_key; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.sensor
|
|
|
+ ADD CONSTRAINT sensor_sensor_name_key UNIQUE (sensor_name);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3670 (class 2606 OID 55653)
|
|
|
+-- Name: system_user systemuser_pk; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.system_user
|
|
|
+ ADD CONSTRAINT systemuser_pk PRIMARY KEY (user_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3651 (class 2606 OID 55557)
|
|
|
+-- Name: unit unit_pk; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit
|
|
|
+ ADD CONSTRAINT unit_pk PRIMARY KEY (unit_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3681 (class 2606 OID 62717)
|
|
|
+-- Name: unit_to_campaign unit_to_campaign_pkey; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_campaign
|
|
|
+ ADD CONSTRAINT unit_to_campaign_pkey PRIMARY KEY (id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3693 (class 2606 OID 62801)
|
|
|
+-- Name: unit_to_group unit_to_group_pkey; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_group
|
|
|
+ ADD CONSTRAINT unit_to_group_pkey PRIMARY KEY (id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3653 (class 2606 OID 55555)
|
|
|
+-- Name: unit_type unittype_pk; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_type
|
|
|
+ ADD CONSTRAINT unittype_pk PRIMARY KEY (unit_type_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3675 (class 2606 OID 55658)
|
|
|
+-- Name: user_to_campaign user_to_campaign_pkey; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.user_to_campaign
|
|
|
+ ADD CONSTRAINT user_to_campaign_pkey PRIMARY KEY (user_id, campaign_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3664 (class 2606 OID 55599)
|
|
|
+-- Name: unit_to_sensor uts_pk; Type: CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_sensor
|
|
|
+ ADD CONSTRAINT uts_pk PRIMARY KEY (unit_id, sensor_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3665 (class 1259 OID 55629)
|
|
|
+-- Name: fki_obss_unitid_fk; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_obss_unitid_fk ON maplog.obs_telemetry USING btree (unit_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3654 (class 1259 OID 55593)
|
|
|
+-- Name: fki_sens_phenom_fk; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_sens_phenom_fk ON maplog.sensor USING btree (phenomenon_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3671 (class 1259 OID 62723)
|
|
|
+-- Name: fki_u2c_campid; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_u2c_campid ON maplog.user_to_campaign USING btree (campaign_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3672 (class 1259 OID 55670)
|
|
|
+-- Name: fki_u2c_campid_fk; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_u2c_campid_fk ON maplog.user_to_campaign USING btree (campaign_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3673 (class 1259 OID 55664)
|
|
|
+-- Name: fki_u2c_userid_fk; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_u2c_userid_fk ON maplog.user_to_campaign USING btree (user_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3678 (class 1259 OID 62735)
|
|
|
+-- Name: fki_un2c_campid; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_un2c_campid ON maplog.unit_to_campaign USING btree (camp_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3679 (class 1259 OID 62729)
|
|
|
+-- Name: fki_un2c_unitid; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_un2c_unitid ON maplog.unit_to_campaign USING btree (unit_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3690 (class 1259 OID 62813)
|
|
|
+-- Name: fki_unit2group_group_fk; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_unit2group_group_fk ON maplog.unit_to_group USING btree (group_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3691 (class 1259 OID 62819)
|
|
|
+-- Name: fki_unit2group_unit_fk; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_unit2group_unit_fk ON maplog.unit_to_group USING btree (unit_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3649 (class 1259 OID 55563)
|
|
|
+-- Name: fki_unit_unittype_fk; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_unit_unittype_fk ON maplog.unit USING btree (unit_type_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3668 (class 1259 OID 62807)
|
|
|
+-- Name: fki_user2group_fk; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_user2group_fk ON maplog.system_user USING btree (group_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3661 (class 1259 OID 55611)
|
|
|
+-- Name: fki_uts_sensorid_fk; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_uts_sensorid_fk ON maplog.unit_to_sensor USING btree (sensor_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3662 (class 1259 OID 55605)
|
|
|
+-- Name: fki_uts_unitid_fk; Type: INDEX; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+CREATE INDEX fki_uts_unitid_fk ON maplog.unit_to_sensor USING btree (unit_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3700 (class 2606 OID 55624)
|
|
|
+-- Name: obs_telemetry obss_unitid_fk; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.obs_telemetry
|
|
|
+ ADD CONSTRAINT obss_unitid_fk FOREIGN KEY (unit_id) REFERENCES maplog.unit(unit_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3697 (class 2606 OID 55588)
|
|
|
+-- Name: sensor sens_phenom_fk; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.sensor
|
|
|
+ ADD CONSTRAINT sens_phenom_fk FOREIGN KEY (phenomenon_id) REFERENCES maplog.phenomenon(phenomenon_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3702 (class 2606 OID 62718)
|
|
|
+-- Name: user_to_campaign u2c_campid; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.user_to_campaign
|
|
|
+ ADD CONSTRAINT u2c_campid FOREIGN KEY (campaign_id) REFERENCES maplog.campaign(campaign_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3703 (class 2606 OID 55659)
|
|
|
+-- Name: user_to_campaign u2c_userid_fk; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.user_to_campaign
|
|
|
+ ADD CONSTRAINT u2c_userid_fk FOREIGN KEY (user_id) REFERENCES maplog.system_user(user_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3704 (class 2606 OID 62730)
|
|
|
+-- Name: unit_to_campaign un2c_campid; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_campaign
|
|
|
+ ADD CONSTRAINT un2c_campid FOREIGN KEY (camp_id) REFERENCES maplog.campaign(campaign_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3705 (class 2606 OID 62724)
|
|
|
+-- Name: unit_to_campaign un2c_unitid; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_campaign
|
|
|
+ ADD CONSTRAINT un2c_unitid FOREIGN KEY (unit_id) REFERENCES maplog.unit(unit_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3706 (class 2606 OID 62808)
|
|
|
+-- Name: unit_to_group unit2group_group_fk; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_group
|
|
|
+ ADD CONSTRAINT unit2group_group_fk FOREIGN KEY (group_id) REFERENCES maplog.groups(group_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3707 (class 2606 OID 62814)
|
|
|
+-- Name: unit_to_group unit2group_unit_fk; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_group
|
|
|
+ ADD CONSTRAINT unit2group_unit_fk FOREIGN KEY (unit_id) REFERENCES maplog.unit(unit_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3696 (class 2606 OID 55558)
|
|
|
+-- Name: unit unit_unittype_fk; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit
|
|
|
+ ADD CONSTRAINT unit_unittype_fk FOREIGN KEY (unit_type_id) REFERENCES maplog.unit_type(unit_type_id);
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3701 (class 2606 OID 62802)
|
|
|
+-- Name: system_user user2group_fk; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.system_user
|
|
|
+ ADD CONSTRAINT user2group_fk FOREIGN KEY (group_id) REFERENCES maplog.groups(group_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3698 (class 2606 OID 55606)
|
|
|
+-- Name: unit_to_sensor uts_sensorid_fk; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_sensor
|
|
|
+ ADD CONSTRAINT uts_sensorid_fk FOREIGN KEY (sensor_id) REFERENCES maplog.sensor(sensor_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3699 (class 2606 OID 55600)
|
|
|
+-- Name: unit_to_sensor uts_unitid_fk; Type: FK CONSTRAINT; Schema: maplog; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+ALTER TABLE ONLY maplog.unit_to_sensor
|
|
|
+ ADD CONSTRAINT uts_unitid_fk FOREIGN KEY (unit_id) REFERENCES maplog.unit(unit_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+-- TOC entry 3862 (class 0 OID 0)
|
|
|
+-- Dependencies: 7
|
|
|
+-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres
|
|
|
+--
|
|
|
+
|
|
|
+REVOKE USAGE ON SCHEMA public FROM PUBLIC;
|
|
|
+GRANT ALL ON SCHEMA public TO PUBLIC;
|
|
|
+
|
|
|
+
|
|
|
+-- Completed on 2023-05-05 01:10:04
|
|
|
+
|
|
|
+--
|
|
|
+-- PostgreSQL database dump complete
|
|
|
+--
|
|
|
+
|