aboutsummaryrefslogtreecommitdiffstats
path: root/sql/dawn.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/dawn.sql')
-rw-r--r--sql/dawn.sql14
1 files changed, 12 insertions, 2 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 86d5c5ec..cb0f6b33 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -121,7 +121,9 @@ CREATE TABLE bond_old(id serial primary key,
CREATE TABLE bonds(id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
dealid varchar(28) GENERATED ALWAYS AS ('SC_'||CASE WHEN asset_class ='Subprime' THEN 'SUB'
WHEN asset_class='CLO' THEN 'CLO'
- WHEN asset_class='CSO' THEN 'CSO' END
+ WHEN asset_class='CSO' THEN 'CSO'
+ WHEN asset_class='CRT' THEN 'CRT'
+ END
||id::text) STORED,
folder bond_strat NOT NULL,
cp_code varchar(12) NOT NULL REFERENCES counterparties(code) ON UPDATE CASCADE,
@@ -135,13 +137,21 @@ CREATE TABLE bonds(id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
faceamount float NOT NULL,
price float NOT NULL,
accrued float,
- asset_class asset_class,
+ asset_class asset_class NOT NULL,
ticket text,
principal_payment float,
accrued_payment float,
current_face float,
+ allocated boolean NOT NULL DEFAULT false,
CONSTRAINT bonds_check CHECK (cusip IS NOT NULL OR isin IS NOT NULL));
+create table allocation(
+ id integer generated always as identity primary key,
+ tradeid integer not null references bonds3,
+ notional float not null,
+ code text not null references accounts,
+ submitted boolean default False);
+
CREATE TRIGGER dealid
AFTER INSERT ON bonds
FOR EACH ROW