diff options
| author | Joe Carstairs <me@joeac.net> | 2024-11-27 19:47:36 +0000 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2024-11-28 23:10:53 +0000 |
| commit | c2e8252f5e963e8c68d7124742f3c1bdf61a083f (patch) | |
| tree | 0d85e9394d90994f1757b9b1cc23780aef55f8fd /rust/schist_models/migrations | |
| parent | 817f6cb7e48e2517dd1612c14357d9aa066a9e53 (diff) | |
AccountTransfer model
Diffstat (limited to 'rust/schist_models/migrations')
| -rw-r--r-- | rust/schist_models/migrations/2024-08-31-084439_initial_setup/down.sql | 1 | ||||
| -rw-r--r-- | rust/schist_models/migrations/2024-08-31-084439_initial_setup/up.sql | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/rust/schist_models/migrations/2024-08-31-084439_initial_setup/down.sql b/rust/schist_models/migrations/2024-08-31-084439_initial_setup/down.sql index b9b1675..ba65012 100644 --- a/rust/schist_models/migrations/2024-08-31-084439_initial_setup/down.sql +++ b/rust/schist_models/migrations/2024-08-31-084439_initial_setup/down.sql @@ -1,4 +1,5 @@ DROP TABLE accounts; +DROP TABLE account_transfers; DROP TABLE budget_drips; DROP TABLE categories; DROP TABLE transaction_categorisations; diff --git a/rust/schist_models/migrations/2024-08-31-084439_initial_setup/up.sql b/rust/schist_models/migrations/2024-08-31-084439_initial_setup/up.sql index a684ce7..a09bf7b 100644 --- a/rust/schist_models/migrations/2024-08-31-084439_initial_setup/up.sql +++ b/rust/schist_models/migrations/2024-08-31-084439_initial_setup/up.sql @@ -7,6 +7,24 @@ CREATE TABLE accounts( opening_date TEXT NOT NULL ); +CREATE TABLE account_transfers( + id INTEGER NOT NULL PRIMARY KEY, + date TEXT NOT NULL, + description TEXT NOT NULL, + quantity INTEGER NOT NULL, + from_account_id INTEGER NOT NULL, + to_account_id INTEGER NOT NULL, + FOREIGN KEY (from_account_id) + REFERENCES accounts (id) + ON UPDATE CASCADE + ON DELETE RESTRICT, + FOREIGN KEY (to_account_id) + REFERENCES accounts (id) + ON UPDATE CASCADE + ON DELETE RESTRICT +); + + CREATE TABLE budget_drips( id INTEGER NOT NULL PRIMARY KEY, category_id INTEGER NOT NULL, |
