From 0a5f40ca1fc270b807ad1e3c6453bcc51ebedfc9 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 11 Oct 2017 13:50:13 -0400 Subject: [PATCH] get rid of deletes, add trans table --- ubm_schema.sql | 80 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 32 deletions(-) diff --git a/ubm_schema.sql b/ubm_schema.sql index e640e3c..3e04f5f 100644 --- a/ubm_schema.sql +++ b/ubm_schema.sql @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 10beta4 --- Dumped by pg_dump version 10beta4 +-- Dumped from database version 10rc1 +-- Dumped by pg_dump version 10rc1 SET statement_timeout = 0; SET lock_timeout = 0; @@ -14,25 +14,6 @@ SET check_function_bodies = false; SET client_min_messages = warning; SET row_security = off; -SET search_path = tps, pg_catalog; - -ALTER TABLE ONLY tps.srce DROP CONSTRAINT srce_pkey; -SET search_path = evt, pg_catalog; - -ALTER TABLE ONLY evt.log DROP CONSTRAINT log_pkey; -SET search_path = tps, pg_catalog; - -DROP TABLE tps.srce; -SET search_path = evt, pg_catalog; - -DROP TABLE evt.log; -SET search_path = tps, pg_catalog; - -DROP TYPE tps.srce_defn_schema; -DROP EXTENSION plpgsql; -DROP SCHEMA tps; -DROP SCHEMA public; -DROP SCHEMA evt; -- -- Name: evt; Type: SCHEMA; Schema: -; Owner: - -- @@ -41,17 +22,10 @@ CREATE SCHEMA evt; -- --- Name: public; Type: SCHEMA; Schema: -; Owner: - +-- Name: SCHEMA evt; Type: COMMENT; Schema: -; Owner: - -- -CREATE SCHEMA public; - - --- --- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON SCHEMA public IS 'standard public schema'; +COMMENT ON SCHEMA evt IS 'events'; -- @@ -61,6 +35,13 @@ COMMENT ON SCHEMA public IS 'standard public schema'; CREATE SCHEMA tps; +-- +-- Name: SCHEMA tps; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON SCHEMA tps IS 'third party source'; + + -- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - -- @@ -129,6 +110,32 @@ CREATE TABLE srce ( ); +-- +-- Name: trans; Type: TABLE; Schema: tps; Owner: - +-- + +CREATE TABLE trans ( + id integer NOT NULL, + srce text, + rec jsonb, + map jsonb +); + + +-- +-- Name: trans_id_seq; Type: SEQUENCE; Schema: tps; Owner: - +-- + +ALTER TABLE trans ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME trans_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + SET search_path = evt, pg_catalog; -- @@ -150,10 +157,19 @@ ALTER TABLE ONLY srce -- --- Name: public; Type: ACL; Schema: -; Owner: - +-- Name: trans trans_pkey; Type: CONSTRAINT; Schema: tps; Owner: - -- -GRANT ALL ON SCHEMA public TO PUBLIC; +ALTER TABLE ONLY trans + ADD CONSTRAINT trans_pkey PRIMARY KEY (id); + + +-- +-- Name: trans trans_srce_fkey; Type: FK CONSTRAINT; Schema: tps; Owner: - +-- + +ALTER TABLE ONLY trans + ADD CONSTRAINT trans_srce_fkey FOREIGN KEY (srce) REFERENCES srce(srce); --