summaryrefslogtreecommitdiff
path: root/backend/migrations/2024-08-31-084439_initial_setup/up.sql
diff options
context:
space:
mode:
Diffstat (limited to 'backend/migrations/2024-08-31-084439_initial_setup/up.sql')
-rw-r--r--backend/migrations/2024-08-31-084439_initial_setup/up.sql7
1 files changed, 6 insertions, 1 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 f2461a5..a43f6dd 100644
--- a/backend/migrations/2024-08-31-084439_initial_setup/up.sql
+++ b/backend/migrations/2024-08-31-084439_initial_setup/up.sql
@@ -26,11 +26,16 @@ CREATE TABLE categories(
initial_period INTEGER NOT NULL
);
-CREATE TABLE category_transactions(
+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