diff options
| author | Joe Carstairs <me@joeac.net> | 2024-11-24 15:45:04 +0000 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2024-11-24 15:56:01 +0000 |
| commit | 1f5dcf9762a83d5972c0c8dbad22732505bf621c (patch) | |
| tree | 5a1f5edd993733d48016ce2a8a8691b8f446858a /rust/schist_models/migrations | |
| parent | 022795ffcaaa0d904c9f911d8a059885c2254278 (diff) | |
Swaps budget updates for budget drips
Diffstat (limited to 'rust/schist_models/migrations')
| -rw-r--r-- | rust/schist_models/migrations/2024-08-31-084439_initial_setup/down.sql | 2 | ||||
| -rw-r--r-- | rust/schist_models/migrations/2024-08-31-084439_initial_setup/up.sql | 16 |
2 files changed, 11 insertions, 7 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 8cf4b1e..b9b1675 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,5 +1,5 @@ DROP TABLE accounts; -DROP TABLE budget_updates; +DROP TABLE budget_drips; DROP TABLE categories; DROP TABLE transaction_categorisations; DROP TABLE category_transfers; 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 9038b54..a684ce7 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,22 +7,26 @@ CREATE TABLE accounts( opening_date TEXT NOT NULL ); -CREATE TABLE budget_updates( +CREATE TABLE budget_drips( 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, - UNIQUE (category_id, date), + quantity INTEGER NOT NULL, FOREIGN KEY (category_id) REFERENCES categories (id) ON UPDATE CASCADE - ON DELETE RESTRICT + ON DELETE RESTRICT, + UNIQUE(category_id, date) ); CREATE TABLE categories( id INTEGER NOT NULL PRIMARY KEY, - name TEXT NOT NULL + name TEXT NOT NULL, + balance INTEGER NOT NULL, + balance_date TEXT NOT NULL, + budget_period INTEGER NOT NULL, + budget_period_unit TEXT NOT NULL, + budget_quantity INTEGER NOT NULL ); CREATE TABLE category_transfers( |
