diff options
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( |
