diff options
Diffstat (limited to 'sql/dawn.sql')
| -rw-r--r-- | sql/dawn.sql | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index 366ae126..24eaf501 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -151,7 +151,10 @@ CREATE TABLE bonds(id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY, allocated boolean NOT NULL DEFAULT false, stale bool NOT NULL DEFAULT true, emailed bool NULL DEFAULT false, - CONSTRAINT bonds_check CHECK (cusip IS NOT NULL OR isin IS NOT NULL)); + CONSTRAINT bonds_check CHECK (((cusip IS NOT NULL) OR (isin IS NOT NULL))), + CONSTRAINT bonds_pkey PRIMARY KEY (id), + CONSTRAINT bonds_cp_code_fkey1 FOREIGN KEY (cp_code) REFERENCES public.counterparties(code) ON UPDATE CASCADE, + CONSTRAINT bonds_fk FOREIGN KEY (bbg_ticket_id) REFERENCES public.bond_tickets(bbg_ticket_id) ON DELETE SET NULL CREATE OR REPLACE FUNCTION notify_id() @@ -2634,3 +2637,31 @@ CREATE TABLE public.equity_options ( CONSTRAINT equity_options_pkey PRIMARY KEY (id), CONSTRAINT equity_options_account_code_fkey FOREIGN KEY (account_code) REFERENCES public.accounts(code) ); + +CREATE TABLE public.bond_tickets ( + bbg_ticket_id text NOT NULL, + "Match" float8 NULL, + "Side" text NULL, + "Security" text NULL, + "Quantity" int8 NULL, + "Price (Dec)" float8 NULL, + "CP" float8 NULL, + "STP Status" text NULL, + "Trade Dt" text NULL, + "SetDt" text NULL, + "Curncy" text NULL, + "Principal" float8 NULL, + "Net" float8 NULL, + "Acc Int" float8 NULL, + "Block Status" text NULL, + "Brkr" text NULL, + "BrkrName" text NULL, + "BrkrName.1" text NULL, + "FIGI" text NULL, + "Cusip" text NULL, + "Curr Face" float8 NULL, + CONSTRAINT bond_tickets_pk PRIMARY KEY (bbg_ticket_id) +); +CREATE INDEX ix_bond_tickets_index ON public.bond_tickets USING btree (bbg_ticket_id); + + |
