aboutsummaryrefslogtreecommitdiffstats
path: root/data/schema.sql
diff options
context:
space:
mode:
Diffstat (limited to 'data/schema.sql')
-rw-r--r--data/schema.sql18
1 files changed, 18 insertions, 0 deletions
diff --git a/data/schema.sql b/data/schema.sql
index 8a9fc3b..8628605 100644
--- a/data/schema.sql
+++ b/data/schema.sql
@@ -1,6 +1,8 @@
DROP TABLE IF EXISTS subtransactions;
DROP TABLE IF EXISTS transactions;
DROP TABLE IF EXISTS payees;
+DROP TABLE IF EXISTS categories_by_month;
+DROP TABLE IF EXISTS months;
DROP TABLE IF EXISTS categories;
DROP TABLE IF EXISTS category_groups;
DROP TABLE IF EXISTS accounts;
@@ -33,6 +35,22 @@ CREATE TABLE categories (
balance bigint NOT NULL
);
+CREATE TABLE months (
+ month text PRIMARY KEY
+);
+
+CREATE TABLE categories_by_month (
+ month text REFERENCES months(month),
+ id text REFERENCES categories(id),
+ category_group_id text REFERENCES category_groups(id) NOT NULL,
+ name text NOT NULL,
+ hidden boolean NOT NULL,
+ budgeted bigint NOT NULL,
+ activity bigint NOT NULL,
+ balance bigint NOT NULL,
+ PRIMARY KEY (month, id)
+);
+
CREATE TABLE payees (
id text PRIMARY KEY,
name text NOT NULL,