diff options
Diffstat (limited to 'sql')
| -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 834b9863..c29181ff 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -3173,15 +3173,15 @@ CREATE TYPE exercise_type AS ENUM ('European', 'American'); CREATE TYPE equity_option_strat AS ENUM ('VOLRV'); CREATE TABLE equityoptions ( - id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY, + id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, dealid varchar(28) NULL GENERATED ALWAYS AS ((('EQOPT_'::text || id::text))) STORED, "fund" "fund" NOT NULL, lastupdate timestamp NULL DEFAULT now(), "action" "action" NOT NULL, "portfolio" "portfolio" NOT NULL, folder text NOT NULL, - cash_account text NOT NULL, - cp_code text NOT NULL, + cash_account text NOT NULL REFERENCES accounts2(cash_account) ON UPDATE CASCADE,, + cp_code text NOT NULL REFERENCES counterparties(code) ON UPDATE CASCADE, trade_date date NOT NULL, settle_date date NOT NULL, expiration_date date NOT NULL, @@ -3199,14 +3199,11 @@ CREATE TABLE equityoptions ( cpty_id text NULL, figi text NULL, globeop_id int4 NULL, - underlyingshares int NOT NULL, - CONSTRAINT equity_options2_pkey PRIMARY KEY (id), - CONSTRAINT equity_options2_cash_account_fkey FOREIGN KEY (cash_account) REFERENCES accounts2(cash_account) ON UPDATE CASCADE, - CONSTRAINT equity_options2_cp_code_fkey FOREIGN KEY (cp_code) REFERENCES counterparties(code) ON UPDATE CASCADE + underlyingshares int NOT NULL ); CREATE TABLE equities2 ( - id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY, + id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, dealid varchar(28) NULL GENERATED ALWAYS AS ((('EQ_'::text || id::text))) STORED, "fund" "fund" NOT NULL, lastupdate timestamp NULL DEFAULT now(), |
