diff options
Diffstat (limited to 'sql/dawn.sql')
| -rw-r--r-- | sql/dawn.sql | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index c4fc6e27..1da82f6b 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -5200,4 +5200,23 @@ FROM LEFT JOIN accounts ON bt.account = accounts.code LEFT JOIN - bond_csv_upload u ON bt.id = u.allocationid;
\ No newline at end of file + bond_csv_upload u ON bt.id = u.allocationid; + +CREATE TYPE spo_reason_code AS ENUM ('S0', 'S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7', 'S8', 'S9'); + + +CREATE TABLE spos ( + id int4 NOT NULL GENERATED ALWAYS AS IDENTITY, + dealid text NULL GENERATED ALWAYS AS ('SPO_'::text || id::text) STORED, + fund fund NOT NULL, + cash_account text NOT NULL, + amount numeric(11, 2) NOT NULL, + currency currency NOT NULL, + cp_code varchar(10) NOT NULL REFERENCES counterparties(code) ON UPDATE CASCADE, + cp_account text NULL, + cp_contact text NULL, + cp_number text NULL, + reason_code spo_reason_code NOT NULL, + CONSTRAINT spos_cash_account_key UNIQUE (cash_account), + CONSTRAINT spos_pkey PRIMARY KEY (id) +);
\ No newline at end of file |
