diff options
| author | Joe Carstairs <me@joeac.net> | 2024-09-17 11:28:56 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2024-09-17 11:28:56 +0100 |
| commit | f0e3e0cfb183253e03b1a61ddecb7b9330d47fdb (patch) | |
| tree | 722eca369743dcfbb95f1efd58cc4cecc0fb8677 /backend/migrations | |
| parent | c737b6df94eae4981bb03dda3583e24046e24865 (diff) | |
Refactors backend
Diffstat (limited to 'backend/migrations')
| -rw-r--r-- | backend/migrations/2024-08-31-084439_initial_setup/up.sql | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/backend/migrations/2024-08-31-084439_initial_setup/up.sql b/backend/migrations/2024-08-31-084439_initial_setup/up.sql index a43f6dd..3584ae7 100644 --- a/backend/migrations/2024-08-31-084439_initial_setup/up.sql +++ b/backend/migrations/2024-08-31-084439_initial_setup/up.sql @@ -21,25 +21,7 @@ CREATE TABLE budget_updates( CREATE TABLE categories( id INTEGER NOT NULL PRIMARY KEY, - name TEXT NOT NULL, - initial_budget INTEGER NOT NULL, - initial_period INTEGER NOT NULL -); - -CREATE TABLE transaction_categorisations( - id INTEGER NOT NULL PRIMARY KEY, - description TEXT NOT NULL, - quantity INTEGER NOT NULL, - transaction_id INTEGER NOT NULL, - category_id INTEGER NOT NULL, - FOREIGN KEY (transaction_id) - REFERENCES transactions (id) - ON UPDATE CASCADE - ON DELETE RESTRICT, - FOREIGN KEY (category_id) - REFERENCES categories (id) - ON UPDATE CASCADE - ON DELETE RESTRICT + name TEXT NOT NULL ); CREATE TABLE category_transfers( @@ -63,9 +45,26 @@ CREATE TABLE transactions( description TEXT NOT NULL, payee TEXT NOT NULL, quantity INTEGER NOT NULL, + date TEXT NOT NULL, account_id INTEGER NOT NULL, FOREIGN KEY (account_id) REFERENCES accounts (id) ON UPDATE CASCADE ON DELETE RESTRICT ); + +CREATE TABLE transaction_categorisations( + id INTEGER NOT NULL PRIMARY KEY, + description TEXT NOT NULL, + quantity INTEGER NOT NULL, + transaction_id INTEGER NOT NULL, + category_id INTEGER NOT NULL, + FOREIGN KEY (transaction_id) + REFERENCES transactions (id) + ON UPDATE CASCADE + ON DELETE RESTRICT, + FOREIGN KEY (category_id) + REFERENCES categories (id) + ON UPDATE CASCADE + ON DELETE RESTRICT +); |
