From aa7c830036125ece290c3d9183024255c3078598 Mon Sep 17 00:00:00 2001 From: Quentin Snow Date: Sun, 5 Feb 2023 21:45:25 -0600 Subject: [PATCH] Update createTables string due to new table layout --- src/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f07c14b..ad2b766 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,12 +16,12 @@ using namespace Budget; -const char* createTables = "CREATE TABLE IF NOT EXISTS account (id INTEGER CONSTRAINT account_pk PRIMARY KEY AUTOINCREMENT, name TEXT, description TEXT, cachedValue DOUBLE);" - "CREATE UNIQUE INDEX IF NOT EXISTS account_name_uindex ON account (name);" - "CREATE TABLE IF NOT EXISTS earning (id INTEGER CONSTRAINT earning_pk PRIMARY KEY AUTOINCREMENT, dollars INT NOT NULL, cents INT NOT NULL, description TEXT, receipt TEXT, accountId INT NOT NULL REFERENCES account ON UPDATE CASCADE ON DELETE CASCADE, date INTEGER NOT NULL);" - "CREATE INDEX IF NOT EXISTS earning_date_index ON earning (date DESC);" - "CREATE TABLE IF NOT EXISTS payment (id INTEGER CONSTRAINT payment_pk PRIMARY KEY AUTOINCREMENT, dollars INT NOT NULL, cents INT NOT NULL, description TEXT, receipt TEXT, accountId INT NOT NULL REFERENCES account ON UPDATE CASCADE ON DELETE CASCADE, date INTEGER NOT NULL);" - "CREATE INDEX IF NOT EXISTS payment_date_index ON payment (date DESC);"; +const char* createTables = "create table if not exists account(id INTEGER constraint account_pk primary key autoincrement, name TEXT, description TEXT, cachedDollars INT, cachedCents INT);" + "create unique index if not exists account_name_uindex on account (name);" + "create table if not exists earning(id INTEGER constraint earning_pk primary key autoincrement, dollars INT not null, cents INT not null, description TEXT, receipt TEXT, accountId INT not null references account on update cascade on delete cascade, date INTEGER not null);" + "create index if not exists earning_date_index on earning (date desc);" + "create table if not exists payment(id INTEGER constraint payment_pk primary key autoincrement, dollars INT not null, cents INT not null, description TEXT, receipt TEXT, accountId INT not null references account on update cascade on delete cascade, date INTEGER not null);" + "create index if not exists payment_date_index on payment (date desc);"; void createRequiredFolders() { std::filesystem::create_directory(configD);