From 957b9ca2959bf9135a7ae4a3cd31e080c323bf0f Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 5 Jan 2020 23:01:47 +0200 Subject: [PATCH] table for profile currencies (commodities), comment for transaction_accounts --- .../net/ktnx/mobileledger/utils/MobileLedgerDatabase.java | 2 +- app/src/main/res/raw/create_db.sql | 4 +++- app/src/main/res/raw/sql_25.sql | 1 + app/src/main/res/raw/sql_26.sql | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/raw/sql_25.sql create mode 100644 app/src/main/res/raw/sql_26.sql diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/MobileLedgerDatabase.java b/app/src/main/java/net/ktnx/mobileledger/utils/MobileLedgerDatabase.java index 9d841ea6..7d73ee65 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/MobileLedgerDatabase.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/MobileLedgerDatabase.java @@ -34,7 +34,7 @@ import static net.ktnx.mobileledger.utils.Logger.debug; public class MobileLedgerDatabase extends SQLiteOpenHelper { private static final String DB_NAME = "MoLe.db"; - private static final int LATEST_REVISION = 24; + private static final int LATEST_REVISION = 26; private static final String CREATE_DB_SQL = "create_db"; private final Application mContext; diff --git a/app/src/main/res/raw/create_db.sql b/app/src/main/res/raw/create_db.sql index edfad6f5..e1467d6c 100644 --- a/app/src/main/res/raw/create_db.sql +++ b/app/src/main/res/raw/create_db.sql @@ -9,4 +9,6 @@ create table profiles(uuid varchar not null primary key, name not null, url not create table transactions(profile varchar not null, id integer not null, data_hash varchar not null, date varchar not null, description varchar not null, keep boolean not null default 0); create unique index un_transactions_id on transactions(profile,id); create unique index un_transactions_data_hash on transactions(profile,data_hash); -create table transaction_accounts(profile varchar not null, transaction_id integer not null, account_name varchar not null, currency varchar not null default '', amount decimal not null, constraint fk_transaction_accounts_acc foreign key(profile,account_name) references accounts(profile,account_name), constraint fk_transaction_accounts_trn foreign key(profile, transaction_id) references transactions(profile,id)); \ No newline at end of file +create table transaction_accounts(profile varchar not null, transaction_id integer not null, account_name varchar not null, currency varchar not null default '', amount decimal not null, comment varchar, constraint fk_transaction_accounts_acc foreign key(profile,account_name) references accounts(profile,account_name), constraint fk_transaction_accounts_trn foreign key(profile, transaction_id) references transactions(profile,id)); +create table currencies(id integer not null primary key, name varchar not null, position varchar not null, has_gap boolean not null); +-- updated to revision 26 \ No newline at end of file diff --git a/app/src/main/res/raw/sql_25.sql b/app/src/main/res/raw/sql_25.sql new file mode 100644 index 00000000..d797a369 --- /dev/null +++ b/app/src/main/res/raw/sql_25.sql @@ -0,0 +1 @@ +create table currencies(id integer not null primary key, name varchar not null, position varchar not null, has_gap boolean not null); \ No newline at end of file diff --git a/app/src/main/res/raw/sql_26.sql b/app/src/main/res/raw/sql_26.sql new file mode 100644 index 00000000..5ef11025 --- /dev/null +++ b/app/src/main/res/raw/sql_26.sql @@ -0,0 +1 @@ +alter table transaction_accounts add comment varchar; \ No newline at end of file -- 2.39.2