/*
- * 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
public class MobileLedgerDatabase extends SQLiteOpenHelper {
private static final String DB_NAME = "MoLe.db";
- private static final int LATEST_REVISION = 28;
+ private static final int LATEST_REVISION = 39;
private static final String CREATE_DB_SQL = "create_db";
private final Application mContext;
@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) {