From f3f1578ca86227f87138bc0728a2f2b10aa29ca0 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 25 Aug 2019 14:49:16 -0400 Subject: also load scheduled transactions --- data/schema.sql | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'data') diff --git a/data/schema.sql b/data/schema.sql index 7da6862..8c28292 100644 --- a/data/schema.sql +++ b/data/schema.sql @@ -1,3 +1,5 @@ +DROP TABLE IF EXISTS scheduled_subtransactions; +DROP TABLE IF EXISTS scheduled_transactions; DROP TABLE IF EXISTS subtransactions; DROP TABLE IF EXISTS transactions; DROP TABLE IF EXISTS payees; @@ -83,3 +85,41 @@ CREATE TABLE subtransactions ( category_id text REFERENCES categories(id), transfer_account_id text REFERENCES accounts(id) ); + +CREATE TYPE frequency_t AS ENUM ( + 'never', + 'daily', + 'weekly', + 'everyOtherWeek', + 'twiceAMonth', + 'every4Weeks', + 'monthly', + 'everyOtherMonth', + 'every3Months', + 'every4Months', + 'twiceAYear', + 'yearly', + 'everyOtherYear' +); +CREATE TABLE scheduled_transactions ( + id text PRIMARY KEY, + date_next date NOT NULL, + frequency frequency_t NOT NULL, + amount bigint NOT NULL, + memo text, + flag_color flag_color_t, + account_id text REFERENCES accounts(id) NOT NULL, + payee_id text REFERENCES payees(id), + category_id text REFERENCES categories(id), + transfer_account_id text REFERENCES accounts(id) +); + +CREATE TABLE scheduled_subtransactions ( + id text PRIMARY KEY, + scheduled_transaction_id text REFERENCES scheduled_transactions(id) NOT NULL, + amount bigint NOT NULL, + memo text, + payee_id text REFERENCES payees(id), + category_id text REFERENCES categories(id), + transfer_account_id text REFERENCES accounts(id) +); -- cgit v1.2.3-54-g00ecf