diff options
| -rw-r--r-- | sql/dawn.sql | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index d6740c0d..2824f844 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -284,7 +284,7 @@ CREATE TABLE cds(id serial primary key, index_ref float DEFAULT NULL, corr_attach float DEFAULT NULL, corr_detach float DEFAULT NULL, - account_code varchar(5) NOT NULL, + account_code varchar(5) NOT NULL REFERENCES accounts(code), cpty_id text, globeop_id int, full_globeop_id text GENERATED ALWAYS AS ('CDS'||lpad(cast(globeop_id as text), 6, '0')|| 'K00SCLMA') STORED, @@ -342,15 +342,13 @@ ON cds FOR EACH ROW EXECUTE PROCEDURE update_attach(); CREATE TABLE repos ( - id int4 NOT NULL DEFAULT nextval('repos_id_seq'::regclass), + id int4 GENERATED ALWAYS AS IDENTITY PRIMARY KEY, dealid varchar(28) NULL GENERATED ALWAYS AS ((('SCREPO'::text || id::text))) STORED, "fund" fund NOT NULL, lastupdate timestamptz NULL DEFAULT now(), "action" action NULL, folder bond_strat NOT NULL, - custodian varchar(12) NOT NULL, - cashaccount varchar(12) NOT NULL, - cp_code varchar(12) NOT NULL, + cp_code varchar(12) NOT NULL REFERENCES counterparties(code), trade_date date NOT NULL, settle_date date NOT NULL, cusip varchar(9) NULL, @@ -366,11 +364,10 @@ CREATE TABLE repos ( haircut float8 NULL, repo_rate float8 NOT NULL, "call_notice" call_notice NULL, - daycount day_count NULL, + day_count day_count NULL, ticket varchar NULL, open_repo bool NULL, - CONSTRAINT repos_pkey PRIMARY KEY (id), - CONSTRAINT repos_cp_code_fkey FOREIGN KEY (cp_code) REFERENCES public.counterparties(code) + account_code text NOT NULL DEFAULT 'BAC' REFERENCES accounts(code), ); |
