forecast_api/build/osm_pool.sql
2023-02-15 14:21:49 -05:00

79 lines
1.9 KiB
SQL

-- rlarp.osm_pool definition
-- Drop table
-- DROP TABLE rlarp.osm_pool;
CREATE TABLE rlarp.osm_pool (
fspr text NULL,
plnt text NULL,
promo text NULL,
terms text NULL,
bill_cust_descr text NULL,
ship_cust_descr text NULL,
dsm text NULL,
quota_rep_descr text NULL,
director text NULL,
billto_group text NULL,
shipto_group text NULL,
chan text NULL,
chansub text NULL,
chan_retail text NULL,
part text NULL,
part_descr text NULL,
part_group text NULL,
branding text NULL,
majg_descr text NULL,
ming_descr text NULL,
majs_descr text NULL,
mins_descr text NULL,
segm text NULL,
substance text NULL,
fs_line text NULL,
r_currency text NULL,
r_rate numeric(31, 10) NULL,
c_currency text NULL,
c_rate numeric(31, 10) NULL,
units numeric(31, 10) NULL,
value_loc numeric(31, 10) NULL,
value_usd numeric NULL,
cost_loc numeric(31, 10) NULL,
cost_usd numeric NULL,
calc_status text NULL,
flag text NULL,
order_date date NULL,
order_month text NULL,
order_season int4 NULL,
request_date date NULL,
request_month text NULL,
request_season int4 NULL,
ship_date date NULL,
ship_month text NULL,
ship_season int4 NULL,
"version" text NULL,
iter text NULL,
logid int4 NULL,
tag text NULL,
"comment" text NULL,
"module" text NULL
);
CREATE INDEX osm_pool_logid ON rlarp.osm_pool USING btree (logid);
CREATE INDEX osm_qr ON rlarp.osm_pool USING btree (quota_rep_descr, bill_cust_descr, ship_cust_descr);
-- rlarp.osm_pool foreign keys
ALTER TABLE rlarp.osm_pool ADD CONSTRAINT logfk FOREIGN KEY (logid) REFERENCES rlarp.osm_log(id);
-- rlarp.osm_log definition
-- Drop table
-- DROP TABLE rlarp.osm_log;
CREATE TABLE rlarp.osm_log (
id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
doc jsonb NULL,
CONSTRAINT osm_log_pkey PRIMARY KEY (id)
);