going somewhere.
This commit is contained in:
1 parent
9ccaeaf410
commit
d262f0d2f8
6 files changed
+121
-28
No files matched your search
@@ -38,17 +38,41 @@ CREATE TABLE IF NOT EXISTS security_permissions
|
||||
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS account_types
|
||||
(
|
||||
name TEXT PRIMARY KEY
|
||||
) STRICT;
|
||||
|
||||
INSERT INTO account_types(name)
|
||||
VALUES ('checking'),
|
||||
('security_emitter');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS accounts
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
security INTEGER NOT NULL,
|
||||
owner INTEGER NOT NULL,
|
||||
account_type TEXT NOT NULL,
|
||||
|
||||
owner INTEGER NOT NULL, -- todo: remove
|
||||
amount INTEGER NOT NULL,
|
||||
timestamp DATETIME NOT NULL,
|
||||
creation_time DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (security) REFERENCES securities (id),
|
||||
FOREIGN KEY (owner) REFERENCES users (id)
|
||||
FOREIGN KEY (owner) REFERENCES users (id),
|
||||
FOREIGN KEY (account_type) REFERENCES account_types (name)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS account_user_permissions
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
account_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
creation_time DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (account_id) REFERENCES account (id),
|
||||
FOREIGN KEY (user_id) REFERENCES users (id)
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user