Alter the Trades table to allow for 3 decimal places in the purchase price and sell price
This commit is contained in:
Binary file not shown.
@@ -2,8 +2,7 @@ CREATE TABLE WatchList
|
||||
(
|
||||
watch_list_id INTEGER NOT NULL,
|
||||
symbol VARCHAR(15) NOT NULL,
|
||||
PRIMARY KEY (watch_list_id, symbol),
|
||||
KEY (watch_list_id)
|
||||
PRIMARY KEY (watch_list_id, symbol)
|
||||
)
|
||||
;
|
||||
|
||||
@@ -13,17 +12,15 @@ CREATE TABLE Trades
|
||||
trade_id INTEGER NOT NULL AUTO_INCREMENT,
|
||||
symbol VARCHAR(15) NOT NULL,
|
||||
trade_date DATETIME NOT NULL,
|
||||
shares NUMERIC(19,2),
|
||||
price NUMERIC(19,2),
|
||||
shares NUMERIC(19,3),
|
||||
price NUMERIC(19,3),
|
||||
buysell CHAR(1),
|
||||
status VARCHAR(10) NOT NULL,
|
||||
account VARCHAR(25) NOT NULL,
|
||||
commission NUMERIC(19,2) NOT NULL,
|
||||
date_sold DATETIME,
|
||||
sell_price NUMERIC(19,2),
|
||||
PRIMARY KEY (trade_id),
|
||||
KEY (account),
|
||||
INDEX IX_Trades (symbol ASC, trade_date ASC)
|
||||
sell_price NUMERIC(19,3),
|
||||
PRIMARY KEY (trade_id)
|
||||
)
|
||||
;
|
||||
|
||||
@@ -37,10 +34,7 @@ CREATE TABLE Cash
|
||||
debit NUMERIC(19,2),
|
||||
balance NUMERIC(19,2),
|
||||
transaction_id INTEGER NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (account, date, transaction_id),
|
||||
UNIQUE (transaction_id),
|
||||
KEY (account),
|
||||
INDEX IDX_DATE (date ASC)
|
||||
PRIMARY KEY (account, date, transaction_id)
|
||||
)
|
||||
;
|
||||
|
||||
@@ -49,8 +43,7 @@ CREATE TABLE WatchLists
|
||||
(
|
||||
watch_list_id INTEGER NOT NULL AUTO_INCREMENT,
|
||||
watch_list_name VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY (watch_list_id),
|
||||
UNIQUE (watch_list_id)
|
||||
PRIMARY KEY (watch_list_id)
|
||||
)
|
||||
;
|
||||
|
||||
@@ -59,10 +52,10 @@ CREATE TABLE StopLimits
|
||||
(
|
||||
symbol VARCHAR(15) NOT NULL,
|
||||
stop_limit NUMERIC(19,2),
|
||||
shares NUMERIC(19,2),
|
||||
shares NUMERIC(19,2) NOT NULL,
|
||||
stop_type VARCHAR(15),
|
||||
active INTEGER,
|
||||
PRIMARY KEY (symbol)
|
||||
PRIMARY KEY (symbol, shares)
|
||||
)
|
||||
;
|
||||
|
||||
@@ -73,19 +66,3 @@ CREATE TABLE Accounts
|
||||
PRIMARY KEY (account)
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ALTER TABLE WatchList ADD CONSTRAINT FK_WatchList_WatchLists
|
||||
FOREIGN KEY (watch_list_id) REFERENCES WatchLists (watch_list_id)
|
||||
;
|
||||
|
||||
ALTER TABLE Trades ADD CONSTRAINT FK_Trades_Accounts
|
||||
FOREIGN KEY (account) REFERENCES Accounts (account)
|
||||
;
|
||||
|
||||
ALTER TABLE Cash ADD CONSTRAINT FK_Cash_Accounts
|
||||
FOREIGN KEY (account) REFERENCES Accounts (account)
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user