diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-08-23 12:17:58 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-08-23 12:17:58 +0200 |
commit | 0ef9af997c98d0252512cc53f436709e88a1e025 (patch) | |
tree | 30315f4ff05aaf42e46ede5e5c7cc92c429e043e /src | |
parent | c6ed89e4109a3db25d9cae8ad1426a3294e721c3 (diff) |
Fixes conditions for cplus db upgrades
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/persistance/DatabaseBackend.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/persistance/DatabaseBackend.java b/src/main/java/de/thedevstack/conversationsplus/persistance/DatabaseBackend.java index 6442e909..7c2583ae 100644 --- a/src/main/java/de/thedevstack/conversationsplus/persistance/DatabaseBackend.java +++ b/src/main/java/de/thedevstack/conversationsplus/persistance/DatabaseBackend.java @@ -198,13 +198,13 @@ public class DatabaseBackend extends SQLiteOpenHelper { protected void onUpgradeCPlusDatabase(SQLiteDatabase db, int oldVersion, int newVersion) { Logging.d("db.upgrade.cplus", "Updating Conversations+ database from version '" + oldVersion + "' to '" + newVersion + "'"); if (oldVersion < newVersion) { - if (oldVersion == 0 && newVersion == 1) { + if (oldVersion < 1 && newVersion >= 1) { Logging.d("db.upgrade.cplus", "Creating additional parameters table for messages."); db.execSQL(MessageDatabaseAccess.TABLE_ADDITIONAL_PARAMETERS_CREATE_V0); db.execSQL("INSERT INTO " + MessageDatabaseAccess.TABLE_NAME_ADDITIONAL_PARAMETERS + "(" + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_MSGUUID + ") " + " SELECT " + Message.UUID + " FROM " + Message.TABLENAME); } - if (newVersion == 2) { + if (oldVersion < 2 && newVersion >= 2) { Logging.d("db.upgrade.cplus", "Encrypt all passwords for the first time"); Cursor cursor = db.rawQuery("SELECT " + Account.UUID + ", " + Account.PASSWORD + " FROM " + Account.TABLENAME, new String[0]); while (cursor.moveToNext()) { |