]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/MobileLedgerDB.java
auto-completion for the transaction description
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / MobileLedgerDB.java
index 141b4a321f5cf9d304513c99bf90bb9ba290e03a..021ee45544c2eee4bf16a21cbf1970f1a1b3cbec 100644 (file)
@@ -14,6 +14,8 @@ import java.util.Locale;
 class MobileLedgerDB {
     static final String DATABASE_NAME = "accounts";
     static final String OPT_DB_REVISION = "db_revision";
+    static final String ACCOUNTS_TABLE = "accounts";
+    static final String DESCRIPTION_HISTORY_TABLE = "description_history";
     private static String db_filename;
     static SQLiteDatabase db;
 
@@ -25,20 +27,9 @@ class MobileLedgerDB {
         MobileLedgerDB.db_filename = db_filename;
     }
 
-    static void initDB() {
+    static void initDB(Resources rm, String pkg_name) {
         db = SQLiteDatabase.openOrCreateDatabase(db_filename, null);
-
-        db.execSQL("create table if not exists accounts(name varchar);");
-        db.execSQL("create index if not exists idx_accounts_name on accounts(name);");
-        db.execSQL("create table if not exists options(name varchar, value varchar);");
-        db.execSQL("create unique index if not exists idx_options_name on options(name);");
-        db.execSQL("create table if not exists account_values(account varchar not null, currency varchar not null, value decimal(18,2) not null);");
-        db.execSQL("create index if not exists idx_account_values_account on account_values(account);");
-        db.execSQL("create unique index if not exists un_account_values on account_values(account,currency);");
-    }
-
-    static void applyRevisions(Resources rm, String pkg_name) {
-        int cur_ver = Integer.parseInt(get_option_value(OPT_DB_REVISION, "0"));
+        int cur_ver = Integer.parseInt(get_option_value(OPT_DB_REVISION, "-1"));
 
         Log.d("db", "Current DB revision is "+String.valueOf(cur_ver));