diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-08-25 14:49:16 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-08-25 14:49:16 -0400 |
commit | f3f1578ca86227f87138bc0728a2f2b10aa29ca0 (patch) | |
tree | d8451aa825d9c9ca780ed5234af2e50060d1d8fb /data | |
parent | 2f3a6515268178796abb6499e207ab90fa308aad (diff) | |
download | ynab-export-f3f1578ca86227f87138bc0728a2f2b10aa29ca0.tar.gz ynab-export-f3f1578ca86227f87138bc0728a2f2b10aa29ca0.zip |
also load scheduled transactions
Diffstat (limited to 'data')
-rw-r--r-- | data/schema.sql | 40 |
1 files changed, 40 insertions, 0 deletions
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) +); |