One test fails :(
This commit is contained in:
1 parent
0a31f89501
commit
1f05ae1957
5 files changed
+170
-12
No files matched your search
@@ -2,7 +2,6 @@ PRAGMA journal_mode= WAL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ledger_internal
|
||||
(
|
||||
-- th
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
creation_time DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
cookie_secret TEXT NOT NULL
|
||||
@@ -38,6 +37,20 @@ CREATE TABLE IF NOT EXISTS securities
|
||||
FOREIGN KEY (security_type) REFERENCES security_types (name)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS interest_rates
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
security_id INTEGER NOT NULL,
|
||||
security_rate_id INTEGER NOT NULL,
|
||||
start_date DATETIME NOT NULL,
|
||||
end_date DATETIME,
|
||||
rate REAL NOT NULL,
|
||||
FOREIGN KEY (security_id) REFERENCES securities(id),
|
||||
CONSTRAINT unique_security_rate_id UNIQUE (security_id, security_rate_id),
|
||||
CHECK (end_date IS NULL OR start_date <= end_date),
|
||||
CHECK ( rate >= 0 )
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS account_types
|
||||
(
|
||||
name TEXT PRIMARY KEY
|
||||
@@ -60,7 +73,9 @@ CREATE TABLE IF NOT EXISTS accounts
|
||||
creation_time DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (security) REFERENCES securities (id),
|
||||
FOREIGN KEY (account_type) REFERENCES account_types (name)
|
||||
FOREIGN KEY (account_type) REFERENCES account_types (name),
|
||||
CHECK (amount >= 0 OR (account_type = 'security_emitter'))
|
||||
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS accounts_history
|
||||
|
||||
Reference in new issue
Block a user