diff options
| author | Joe Carstairs <me@joeac.net> | 2024-10-16 12:51:21 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2024-10-16 12:51:21 +0100 |
| commit | 27b95c9186bd45edd4c982a7cc89cf69cf2c5d46 (patch) | |
| tree | bf104ff9d64e601bfec5516eb51ef298f3095e9b /backend/migrations | |
| parent | 76974785294089965efc3f55b2a08d4089029c52 (diff) | |
All backend stuff lives in backend folder
Diffstat (limited to 'backend/migrations')
| -rw-r--r-- | backend/migrations/.keep | 0 | ||||
| -rw-r--r-- | backend/migrations/2024-08-31-084439_initial_setup/down.sql | 6 | ||||
| -rw-r--r-- | backend/migrations/2024-08-31-084439_initial_setup/up.sql | 70 |
3 files changed, 0 insertions, 76 deletions
diff --git a/backend/migrations/.keep b/backend/migrations/.keep deleted file mode 100644 index e69de29..0000000 --- a/backend/migrations/.keep +++ /dev/null diff --git a/backend/migrations/2024-08-31-084439_initial_setup/down.sql b/backend/migrations/2024-08-31-084439_initial_setup/down.sql deleted file mode 100644 index 8cf4b1e..0000000 --- a/backend/migrations/2024-08-31-084439_initial_setup/down.sql +++ /dev/null @@ -1,6 +0,0 @@ -DROP TABLE accounts; -DROP TABLE budget_updates; -DROP TABLE categories; -DROP TABLE transaction_categorisations; -DROP TABLE category_transfers; -DROP TABLE transactions; diff --git a/backend/migrations/2024-08-31-084439_initial_setup/up.sql b/backend/migrations/2024-08-31-084439_initial_setup/up.sql deleted file mode 100644 index 3584ae7..0000000 --- a/backend/migrations/2024-08-31-084439_initial_setup/up.sql +++ /dev/null @@ -1,70 +0,0 @@ -PRAGMA foreign_keys = ON; - -CREATE TABLE accounts( - id INTEGER NOT NULL PRIMARY KEY, - name TEXT NOT NULL, - opening_balance INTEGER NOT NULL, - opening_date TEXT NOT NULL -); - -CREATE TABLE budget_updates( - id INTEGER NOT NULL PRIMARY KEY, - category_id INTEGER NOT NULL, - date TEXT NOT NULL, - new_budget INTEGER NOT NULL, - new_period INTEGER NOT NULL, - FOREIGN KEY (category_id) - REFERENCES categories (id) - ON UPDATE CASCADE - ON DELETE RESTRICT -); - -CREATE TABLE categories( - id INTEGER NOT NULL PRIMARY KEY, - name TEXT NOT NULL -); - -CREATE TABLE category_transfers( - id INTEGER NOT NULL PRIMARY KEY, - description TEXT NOT NULL, - quantity INTEGER NOT NULL, - from_category_id INTEGER NOT NULL, - to_category_id INTEGER NOT NULL, - FOREIGN KEY (from_category_id) - REFERENCES categories (id) - ON UPDATE CASCADE - ON DELETE RESTRICT, - FOREIGN KEY (to_category_id) - REFERENCES categories (id) - ON UPDATE CASCADE - ON DELETE RESTRICT -); - -CREATE TABLE transactions( - id INTEGER NOT NULL PRIMARY KEY, - 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 -); |
