Skip to content

Instantly share code, notes, and snippets.

@roy-bukapeta
Last active November 10, 2017 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roy-bukapeta/696d87b282ead89c8dfa45e2b74ddc69 to your computer and use it in GitHub Desktop.
Save roy-bukapeta/696d87b282ead89c8dfa45e2b74ddc69 to your computer and use it in GitHub Desktop.
Monggo kuh
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.5.8
-- Dumped by pg_dump version 9.5.8
-- Started on 2017-11-10 13:29:29 WIB
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 1 (class 3079 OID 12395)
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- TOC entry 2242 (class 0 OID 0)
-- Dependencies: 1
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- TOC entry 2 (class 3079 OID 512988)
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
--
-- TOC entry 2243 (class 0 OID 0)
-- Dependencies: 2
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 182 (class 1259 OID 512999)
-- Name: maps_api_source; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE maps_api_source (
id bigint NOT NULL,
api_source_type_id bigint NOT NULL,
url character varying NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone,
is_deleted integer DEFAULT 0 NOT NULL
);
--
-- TOC entry 2244 (class 0 OID 0)
-- Dependencies: 182
-- Name: COLUMN maps_api_source.is_deleted; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN maps_api_source.is_deleted IS '0 = not deleted | 1 = deleted';
--
-- TOC entry 183 (class 1259 OID 513008)
-- Name: api_source_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE api_source_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- TOC entry 2245 (class 0 OID 0)
-- Dependencies: 183
-- Name: api_source_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE api_source_id_seq OWNED BY maps_api_source.id;
--
-- TOC entry 184 (class 1259 OID 513010)
-- Name: maps_api_source_type; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE maps_api_source_type (
id bigint NOT NULL,
name character varying,
is_active integer DEFAULT 1 NOT NULL
);
--
-- TOC entry 2246 (class 0 OID 0)
-- Dependencies: 184
-- Name: COLUMN maps_api_source_type.is_active; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN maps_api_source_type.is_active IS '0 = not activated | 1 = activated';
--
-- TOC entry 185 (class 1259 OID 513017)
-- Name: api_source_type_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE api_source_type_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- TOC entry 2247 (class 0 OID 0)
-- Dependencies: 185
-- Name: api_source_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE api_source_type_id_seq OWNED BY maps_api_source_type.id;
--
-- TOC entry 187 (class 1259 OID 513031)
-- Name: maps_layers_source_type; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE maps_layers_source_type (
id bigint NOT NULL,
type character varying NOT NULL,
is_active integer DEFAULT 1 NOT NULL
);
--
-- TOC entry 2248 (class 0 OID 0)
-- Dependencies: 187
-- Name: COLUMN maps_layers_source_type.is_active; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN maps_layers_source_type.is_active IS '0 = not activated | 1= activated';
--
-- TOC entry 188 (class 1259 OID 513038)
-- Name: layer_source_type_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE layer_source_type_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- TOC entry 2249 (class 0 OID 0)
-- Dependencies: 188
-- Name: layer_source_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE layer_source_type_id_seq OWNED BY maps_layers_source_type.id;
--
-- TOC entry 189 (class 1259 OID 513040)
-- Name: maps_tema; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE maps_tema (
id bigint NOT NULL,
name character varying,
is_active integer DEFAULT 1 NOT NULL
);
--
-- TOC entry 2250 (class 0 OID 0)
-- Dependencies: 189
-- Name: COLUMN maps_tema.is_active; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN maps_tema.is_active IS '0 = not activated | 1 = activated';
--
-- TOC entry 190 (class 1259 OID 513047)
-- Name: map_tema_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE map_tema_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- TOC entry 2251 (class 0 OID 0)
-- Dependencies: 190
-- Name: map_tema_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE map_tema_id_seq OWNED BY maps_tema.id;
--
-- TOC entry 191 (class 1259 OID 513049)
-- Name: maps; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE maps (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
map_tema_id bigint DEFAULT 1,
user_id uuid NOT NULL,
title character varying NOT NULL,
description text,
version character varying DEFAULT '0.1.0'::text,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone,
is_deleted integer DEFAULT 0 NOT NULL,
is_published boolean DEFAULT true NOT NULL,
script_js text,
url character varying NOT NULL
);
--
-- TOC entry 2252 (class 0 OID 0)
-- Dependencies: 191
-- Name: TABLE maps; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON TABLE maps IS 'Tabel yang menyimpan informasi entitas peta';
--
-- TOC entry 2253 (class 0 OID 0)
-- Dependencies: 191
-- Name: COLUMN maps.is_deleted; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN maps.is_deleted IS '0 = not deleted | 1 = deleted';
--
-- TOC entry 186 (class 1259 OID 513019)
-- Name: maps_layers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE maps_layers (
id uuid DEFAULT uuid_generate_v4() NOT NULL,
layer_source_type_id bigint,
data_vector_id uuid,
api_id bigint,
user_id uuid NOT NULL,
name character varying NOT NULL,
description text,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone,
is_deleted integer DEFAULT 0 NOT NULL,
popup json DEFAULT '[]'::json,
styles json DEFAULT '[]'::json
);
--
-- TOC entry 2254 (class 0 OID 0)
-- Dependencies: 186
-- Name: COLUMN maps_layers.is_deleted; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN maps_layers.is_deleted IS '0 = not deleted | 1 = deleted';
--
-- TOC entry 193 (class 1259 OID 513260)
-- Name: maps_layers_relation; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE maps_layers_relation (
id integer NOT NULL,
maps_id uuid NOT NULL,
maps_layers_id uuid NOT NULL
);
--
-- TOC entry 192 (class 1259 OID 513258)
-- Name: maps_layers_relation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE maps_layers_relation_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- TOC entry 2255 (class 0 OID 0)
-- Dependencies: 192
-- Name: maps_layers_relation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE maps_layers_relation_id_seq OWNED BY maps_layers_relation.id;
--
-- TOC entry 2069 (class 2604 OID 513061)
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_api_source ALTER COLUMN id SET DEFAULT nextval('api_source_id_seq'::regclass);
--
-- TOC entry 2072 (class 2604 OID 513062)
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_api_source_type ALTER COLUMN id SET DEFAULT nextval('api_source_type_id_seq'::regclass);
--
-- TOC entry 2088 (class 2604 OID 513263)
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_layers_relation ALTER COLUMN id SET DEFAULT nextval('maps_layers_relation_id_seq'::regclass);
--
-- TOC entry 2079 (class 2604 OID 513063)
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_layers_source_type ALTER COLUMN id SET DEFAULT nextval('layer_source_type_id_seq'::regclass);
--
-- TOC entry 2081 (class 2604 OID 513064)
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_tema ALTER COLUMN id SET DEFAULT nextval('map_tema_id_seq'::regclass);
--
-- TOC entry 2256 (class 0 OID 0)
-- Dependencies: 183
-- Name: api_source_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('api_source_id_seq', 1, false);
--
-- TOC entry 2257 (class 0 OID 0)
-- Dependencies: 185
-- Name: api_source_type_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('api_source_type_id_seq', 4, true);
--
-- TOC entry 2258 (class 0 OID 0)
-- Dependencies: 188
-- Name: layer_source_type_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('layer_source_type_id_seq', 2, true);
--
-- TOC entry 2259 (class 0 OID 0)
-- Dependencies: 190
-- Name: map_tema_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('map_tema_id_seq', 1, true);
--
-- TOC entry 2232 (class 0 OID 513049)
-- Dependencies: 191
-- Data for Name: maps; Type: TABLE DATA; Schema: public; Owner: -
--
--
-- TOC entry 2223 (class 0 OID 512999)
-- Dependencies: 182
-- Data for Name: maps_api_source; Type: TABLE DATA; Schema: public; Owner: -
--
--
-- TOC entry 2225 (class 0 OID 513010)
-- Dependencies: 184
-- Data for Name: maps_api_source_type; Type: TABLE DATA; Schema: public; Owner: -
--
INSERT INTO maps_api_source_type (id, name, is_active) VALUES (1, 'WMS', 1);
INSERT INTO maps_api_source_type (id, name, is_active) VALUES (2, 'TMS', 1);
INSERT INTO maps_api_source_type (id, name, is_active) VALUES (3, 'Geojson', 0);
INSERT INTO maps_api_source_type (id, name, is_active) VALUES (4, 'Google Vector Tile', 0);
--
-- TOC entry 2227 (class 0 OID 513019)
-- Dependencies: 186
-- Data for Name: maps_layers; Type: TABLE DATA; Schema: public; Owner: -
--
--
-- TOC entry 2234 (class 0 OID 513260)
-- Dependencies: 193
-- Data for Name: maps_layers_relation; Type: TABLE DATA; Schema: public; Owner: -
--
--
-- TOC entry 2260 (class 0 OID 0)
-- Dependencies: 192
-- Name: maps_layers_relation_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('maps_layers_relation_id_seq', 1, false);
--
-- TOC entry 2228 (class 0 OID 513031)
-- Dependencies: 187
-- Data for Name: maps_layers_source_type; Type: TABLE DATA; Schema: public; Owner: -
--
INSERT INTO maps_layers_source_type (id, type, is_active) VALUES (1, 'Entity', 1);
INSERT INTO maps_layers_source_type (id, type, is_active) VALUES (2, 'API', 1);
--
-- TOC entry 2230 (class 0 OID 513040)
-- Dependencies: 189
-- Data for Name: maps_tema; Type: TABLE DATA; Schema: public; Owner: -
--
INSERT INTO maps_tema (id, name, is_active) VALUES (1, 'Tidak bertem', 1);
--
-- TOC entry 2090 (class 2606 OID 513066)
-- Name: api_source_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_api_source
ADD CONSTRAINT api_source_pkey PRIMARY KEY (id);
--
-- TOC entry 2092 (class 2606 OID 513068)
-- Name: api_source_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_api_source_type
ADD CONSTRAINT api_source_type_pkey PRIMARY KEY (id);
--
-- TOC entry 2094 (class 2606 OID 513070)
-- Name: layer_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_layers
ADD CONSTRAINT layer_pkey PRIMARY KEY (id);
--
-- TOC entry 2096 (class 2606 OID 513072)
-- Name: layer_source_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_layers_source_type
ADD CONSTRAINT layer_source_type_pkey PRIMARY KEY (id);
--
-- TOC entry 2098 (class 2606 OID 513074)
-- Name: map_tema_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_tema
ADD CONSTRAINT map_tema_pkey PRIMARY KEY (id);
--
-- TOC entry 2104 (class 2606 OID 513265)
-- Name: maps_layers_relation_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_layers_relation
ADD CONSTRAINT maps_layers_relation_pkey PRIMARY KEY (id);
--
-- TOC entry 2100 (class 2606 OID 513076)
-- Name: maps_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps
ADD CONSTRAINT maps_pkey PRIMARY KEY (id);
--
-- TOC entry 2102 (class 2606 OID 513078)
-- Name: maps_url_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps
ADD CONSTRAINT maps_url_key UNIQUE (url);
--
-- TOC entry 2105 (class 2606 OID 513079)
-- Name: api_source_api_source_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_api_source
ADD CONSTRAINT api_source_api_source_type_id_fkey FOREIGN KEY (api_source_type_id) REFERENCES maps_api_source_type(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
--
-- TOC entry 2106 (class 2606 OID 513084)
-- Name: layer_api_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_layers
ADD CONSTRAINT layer_api_id_fkey FOREIGN KEY (api_id) REFERENCES maps_api_source(id) ON DELETE CASCADE;
--
-- TOC entry 2107 (class 2606 OID 513089)
-- Name: layer_layer_source_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps_layers
ADD CONSTRAINT layer_layer_source_type_id_fkey FOREIGN KEY (layer_source_type_id) REFERENCES maps_layers_source_type(id) ON DELETE CASCADE;
--
-- TOC entry 2108 (class 2606 OID 513094)
-- Name: maps_map_tema_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY maps
ADD CONSTRAINT maps_map_tema_id_fkey FOREIGN KEY (map_tema_id) REFERENCES maps_tema(id) ON DELETE CASCADE;
--
-- TOC entry 2241 (class 0 OID 0)
-- Dependencies: 7
-- Name: public; Type: ACL; Schema: -; Owner: -
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
-- Completed on 2017-11-10 13:29:29 WIB
--
-- PostgreSQL database dump complete
--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment