From bc16336667e46d6511236b0dfe487ee605420659 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 3 May 2020 14:10:26 +0300 Subject: [PATCH] delete stray options of already removed profiles --- .../java/net/ktnx/mobileledger/utils/MobileLedgerDatabase.java | 2 +- app/src/main/res/raw/create_db.sql | 2 +- app/src/main/res/raw/sql_30.sql | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/raw/sql_30.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 cd0fcc41..77e306db 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 = 29; + private static final int LATEST_REVISION = 30; 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 deeade8d..50cf2fdb 100644 --- a/app/src/main/res/raw/create_db.sql +++ b/app/src/main/res/raw/create_db.sql @@ -12,4 +12,4 @@ create unique index un_transactions_data_hash on transactions(profile,data_hash) create index idx_transaction_description on transactions(description); 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 29 +-- updated to revision 30 \ No newline at end of file diff --git a/app/src/main/res/raw/sql_30.sql b/app/src/main/res/raw/sql_30.sql new file mode 100644 index 00000000..c82adf84 --- /dev/null +++ b/app/src/main/res/raw/sql_30.sql @@ -0,0 +1 @@ +delete from options where profile <> '-' and not exists (select 1 from profiles p where p.uuid=options.profile); \ No newline at end of file -- 2.39.5