]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/utils/MobileLedgerDatabase.java
major rework of parsed transaction/descriptions/accounts storage
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / utils / MobileLedgerDatabase.java
index 9d841ea62035490edd15e325693fe38bae878b4a..3e1919e17a6516cd09d6c7892439f48a04ed02f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2020 Damyan Ivanov.
  * This file is part of MoLe.
  * MoLe is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
@@ -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 = 39;
     private static final String CREATE_DB_SQL = "create_db";
 
     private final Application mContext;
@@ -55,7 +55,14 @@ public class MobileLedgerDatabase extends SQLiteOpenHelper {
     @Override
     public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
         debug("db", "onUpgrade called");
-        for (int i = oldVersion + 1; i <= newVersion; i++) applyRevision(db, i);
+        for (int i = oldVersion + 1; i <= newVersion; i++)
+            applyRevision(db, i);
+    }
+    @Override
+    public void onOpen(SQLiteDatabase db) {
+        super.onOpen(db);
+        db.execSQL("pragma case_sensitive_like=ON;");
+        db.execSQL("PRAGMA foreign_keys=ON");
     }
 
     private void applyRevision(SQLiteDatabase db, int rev_no) {