I need to fucking work.

This commit is contained in:
didier amyot committed 2023-01-25 12:50:16 -05:00
1 parent e1e5d5dbf3
commit f99513a8c8
7 files changed
+230 -53

No files matched your search

+22 -10
View File
@@ -37,6 +37,7 @@ VALUES ('checking'),
CREATE TABLE IF NOT EXISTS accounts
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
version INTEGER NOT NULL CHECK ( version >= 0 ),
security INTEGER NOT NULL,
account_type TEXT NOT NULL,
@@ -48,6 +49,16 @@ CREATE TABLE IF NOT EXISTS accounts
FOREIGN KEY (account_type) REFERENCES account_types (name)
);
CREATE TABLE IF NOT EXISTS accounts_history
(
account_id INTEGER NOT NULL,
account_version INTEGER NOT NULL,
amount INTEGER NOT NULL,
timestamp DATETIME NOT NULL,
FOREIGN KEY (account_id) REFERENCES accounts (id),
PRIMARY KEY (account_id, account_version)
);
CREATE TABLE IF NOT EXISTS account_user_permissions
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -60,18 +71,19 @@ CREATE TABLE IF NOT EXISTS account_user_permissions
);
CREATE TABLE IF NOT EXISTS cashed_cheques
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
drawer_user_id INTEGER NOT NULL,
drawer_account_id INTEGER NOT NULL,
cheque_number INTEGER NOT NULL,
amount INTEGER NOT NULL,
underlying_security INTEGER NOT NULL,
payee_user_id INTEGER NOT NULL,
payee_account_id INTEGER NOT NULL,
creation_time DATETIME DEFAULT CURRENT_TIMESTAMP,
id INTEGER PRIMARY KEY AUTOINCREMENT,
drawer_user_id INTEGER NOT NULL,
drawer_account_id INTEGER NOT NULL,
drawer_account_version INTEGER NOT NULL,
cheque_number INTEGER NOT NULL,
amount INTEGER NOT NULL,
underlying_security INTEGER NOT NULL,
payee_user_id INTEGER NOT NULL,
payee_account_id INTEGER NOT NULL,
payee_account_version INTEGER NOT NULL,
creation_time DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (underlying_security) REFERENCES securities (id),
FOREIGN KEY (drawer_user_id) REFERENCES users (id),