resolve merge
This commit is contained in:
commit
c4dcb6edc8
@ -50,7 +50,6 @@ COMMENT ON TYPE tps."DCARD" IS 'Discover Card';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: DMAPI; Type: TYPE; Schema: tps; Owner: -
|
-- Name: DMAPI; Type: TYPE; Schema: tps; Owner: -
|
||||||
--
|
--
|
||||||
@ -60,6 +59,41 @@ CREATE TYPE tps."DMAPI" AS (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: WMPD; Type: TYPE; Schema: tps; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TYPE tps."WMPD" AS (
|
||||||
|
"Carrier" text,
|
||||||
|
"SCAC" text,
|
||||||
|
"Mode" text,
|
||||||
|
"Pro #" text,
|
||||||
|
"B/L" text,
|
||||||
|
"Pd Amt" numeric,
|
||||||
|
"Loc#" text,
|
||||||
|
"Pcs" numeric,
|
||||||
|
"Wgt" numeric,
|
||||||
|
"Chk#" numeric,
|
||||||
|
"Pay Dt" date,
|
||||||
|
"Acct #" text,
|
||||||
|
"I/O" text,
|
||||||
|
"Sh Nm" text,
|
||||||
|
"Sh City" text,
|
||||||
|
"Sh St" text,
|
||||||
|
"Sh Zip" text,
|
||||||
|
"Cons Nm" text,
|
||||||
|
"D City " text,
|
||||||
|
"D St" text,
|
||||||
|
"D Zip" text,
|
||||||
|
"Sh Dt" date,
|
||||||
|
"Inv Dt" date,
|
||||||
|
"Customs Entry#" text,
|
||||||
|
"Miles" numeric,
|
||||||
|
"Frt Class" text,
|
||||||
|
"Master B/L" text
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: dcard; Type: TYPE; Schema: tps; Owner: -
|
-- Name: dcard; Type: TYPE; Schema: tps; Owner: -
|
||||||
--
|
--
|
||||||
@ -1067,10 +1101,10 @@ $_$;
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: srce_set(text, jsonb); Type: FUNCTION; Schema: tps; Owner: -
|
-- Name: srce_set(jsonb); Type: FUNCTION; Schema: tps; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE FUNCTION tps.srce_set(_name text, _defn jsonb) RETURNS jsonb
|
CREATE FUNCTION tps.srce_set(_defn jsonb) RETURNS jsonb
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
AS $_$
|
AS $_$
|
||||||
|
|
||||||
@ -1097,7 +1131,7 @@ BEGIN
|
|||||||
FROM
|
FROM
|
||||||
tps.srce
|
tps.srce
|
||||||
WHERE
|
WHERE
|
||||||
srce = _name;
|
srce = _defn->>'name';
|
||||||
|
|
||||||
-------check for transctions already existing under this source-----------
|
-------check for transctions already existing under this source-----------
|
||||||
SELECT
|
SELECT
|
||||||
@ -1107,7 +1141,7 @@ BEGIN
|
|||||||
FROM
|
FROM
|
||||||
tps.trans
|
tps.trans
|
||||||
WHERE
|
WHERE
|
||||||
srce = _name;
|
srce = _defn->>'name';
|
||||||
|
|
||||||
--if there are transaction already and the schema is different stop--------
|
--if there are transaction already and the schema is different stop--------
|
||||||
IF _cnt > 0 THEN
|
IF _cnt > 0 THEN
|
||||||
@ -1133,14 +1167,14 @@ BEGIN
|
|||||||
INSERT INTO
|
INSERT INTO
|
||||||
tps.srce
|
tps.srce
|
||||||
SELECT
|
SELECT
|
||||||
_name, _defn
|
_defn->>'name', _defn
|
||||||
ON CONFLICT ON CONSTRAINT srce_pkey DO UPDATE
|
ON CONFLICT ON CONSTRAINT srce_pkey DO UPDATE
|
||||||
SET
|
SET
|
||||||
defn = _defn;
|
defn = _defn;
|
||||||
|
|
||||||
------------------drop existing type-----------------------------------------
|
------------------drop existing type-----------------------------------------
|
||||||
|
|
||||||
EXECUTE format('DROP TYPE IF EXISTS tps.%I',_name);
|
EXECUTE format('DROP TYPE IF EXISTS tps.%I',_defn->>'name');
|
||||||
|
|
||||||
------------------create new type--------------------------------------------
|
------------------create new type--------------------------------------------
|
||||||
|
|
||||||
@ -1153,15 +1187,15 @@ BEGIN
|
|||||||
--unwrap the schema definition array
|
--unwrap the schema definition array
|
||||||
LEFT JOIN LATERAL jsonb_populate_recordset(null::tps.srce_defn_schema, defn->'schema') prs ON TRUE
|
LEFT JOIN LATERAL jsonb_populate_recordset(null::tps.srce_defn_schema, defn->'schema') prs ON TRUE
|
||||||
WHERE
|
WHERE
|
||||||
srce = _name
|
srce = _defn->>'name'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
srce;
|
srce;
|
||||||
|
|
||||||
RAISE NOTICE 'CREATE TYPE tps.% AS (%)',_name,_sql;
|
RAISE NOTICE 'CREATE TYPE tps.% AS (%)',_defn->>'name',_sql;
|
||||||
|
|
||||||
EXECUTE format('CREATE TYPE tps.%I AS (%s)',_name,_sql);
|
EXECUTE format('CREATE TYPE tps.%I AS (%s)',_defn->>'name',_sql);
|
||||||
|
|
||||||
EXECUTE format('COMMENT ON TYPE tps.%I IS %L',_name,(_defn->>'description'));
|
EXECUTE format('COMMENT ON TYPE tps.%I IS %L',_defn->>'name',(_defn->>'description'));
|
||||||
|
|
||||||
----------------set message-----------------------------------------------------
|
----------------set message-----------------------------------------------------
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
CREATE OR REPLACE FUNCTION tps.srce_set(_name text, _defn jsonb) RETURNS jsonb
|
CREATE OR REPLACE FUNCTION tps.srce_set(_defn jsonb) RETURNS jsonb
|
||||||
AS $f$
|
AS $f$
|
||||||
|
|
||||||
DECLARE
|
DECLARE
|
||||||
@ -25,7 +25,7 @@ BEGIN
|
|||||||
FROM
|
FROM
|
||||||
tps.srce
|
tps.srce
|
||||||
WHERE
|
WHERE
|
||||||
srce = _name;
|
srce = _defn->>'name';
|
||||||
|
|
||||||
-------check for transctions already existing under this source-----------
|
-------check for transctions already existing under this source-----------
|
||||||
SELECT
|
SELECT
|
||||||
@ -35,7 +35,7 @@ BEGIN
|
|||||||
FROM
|
FROM
|
||||||
tps.trans
|
tps.trans
|
||||||
WHERE
|
WHERE
|
||||||
srce = _name;
|
srce = _defn->>'name';
|
||||||
|
|
||||||
--if there are transaction already and the schema is different stop--------
|
--if there are transaction already and the schema is different stop--------
|
||||||
IF _cnt > 0 THEN
|
IF _cnt > 0 THEN
|
||||||
@ -61,14 +61,14 @@ BEGIN
|
|||||||
INSERT INTO
|
INSERT INTO
|
||||||
tps.srce
|
tps.srce
|
||||||
SELECT
|
SELECT
|
||||||
_name, _defn
|
_defn->>'name', _defn
|
||||||
ON CONFLICT ON CONSTRAINT srce_pkey DO UPDATE
|
ON CONFLICT ON CONSTRAINT srce_pkey DO UPDATE
|
||||||
SET
|
SET
|
||||||
defn = _defn;
|
defn = _defn;
|
||||||
|
|
||||||
------------------drop existing type-----------------------------------------
|
------------------drop existing type-----------------------------------------
|
||||||
|
|
||||||
EXECUTE format('DROP TYPE IF EXISTS tps.%I',_name);
|
EXECUTE format('DROP TYPE IF EXISTS tps.%I',_defn->>'name');
|
||||||
|
|
||||||
------------------create new type--------------------------------------------
|
------------------create new type--------------------------------------------
|
||||||
|
|
||||||
@ -81,15 +81,15 @@ BEGIN
|
|||||||
--unwrap the schema definition array
|
--unwrap the schema definition array
|
||||||
LEFT JOIN LATERAL jsonb_populate_recordset(null::tps.srce_defn_schema, defn->'schema') prs ON TRUE
|
LEFT JOIN LATERAL jsonb_populate_recordset(null::tps.srce_defn_schema, defn->'schema') prs ON TRUE
|
||||||
WHERE
|
WHERE
|
||||||
srce = _name
|
srce = _defn->>'name'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
srce;
|
srce;
|
||||||
|
|
||||||
RAISE NOTICE 'CREATE TYPE tps.% AS (%)',_name,_sql;
|
RAISE NOTICE 'CREATE TYPE tps.% AS (%)',_defn->>'name',_sql;
|
||||||
|
|
||||||
EXECUTE format('CREATE TYPE tps.%I AS (%s)',_name,_sql);
|
EXECUTE format('CREATE TYPE tps.%I AS (%s)',_defn->>'name',_sql);
|
||||||
|
|
||||||
EXECUTE format('COMMENT ON TYPE tps.%I IS %L',_name,(_defn->>'description'));
|
EXECUTE format('COMMENT ON TYPE tps.%I IS %L',_defn->>'name',(_defn->>'description'));
|
||||||
|
|
||||||
----------------set message-----------------------------------------------------
|
----------------set message-----------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user