added funds table, currency table
This commit is contained in:
parent
2b82d182aa
commit
d97d852ce9
|
|
@ -51,6 +51,26 @@ raw_sha256 CHAR(64) UNIQUE,
|
|||
processed BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS funds(
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
datetime DATE NOT NULL,
|
||||
amount REAL NOT NULL,
|
||||
accountid INT NOT NULL REFERENCES accounts(id) ON DELETE SET NULL,
|
||||
orgid INT NOT NULL REFERENCES organizations(id) ON DELETE SET NULL,
|
||||
fundid VARCHAR(100) NOT NULL,
|
||||
value REAL NOT NULL,
|
||||
shares REAL NOT NULL,
|
||||
currencyid INT REFERENCES currency(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS currency(
|
||||
id SERIAL PRIMARY KEY,
|
||||
currencycode CHAR(3) UNIQUE NOT NULL,
|
||||
currencyname VARCHAR(50) NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS rawtransactions_data_idx ON rawtransactions USING GIN (data);
|
||||
CREATE INDEX IF NOT EXISTS rawtransactions_received_at_idx ON rawtransactions (received_at);
|
||||
CREATE INDEX IF NOT EXISTS rawtransactions_account_org_idx ON rawtransactions (orgid, accountid);
|
||||
Loading…
Reference in a new issue