Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Niedermann <info@niedermann.it>2021-05-11 22:26:20 +0300
committerNiedermann IT-Dienstleistungen <stefan-niedermann@users.noreply.github.com>2021-05-12 11:58:43 +0300
commit6fd4fa5796cb3ba48c10b5faa74e030561bd7d9b (patch)
tree9ebad6465c8b47f32e9226e8968ec28dcd1efd87 /app/src/main/java/it/niedermann
parent3ddfde9a5418ba23aef752162c73d423a5e207a3 (diff)
Sanitize API versions while migrating the database
Diffstat (limited to 'app/src/main/java/it/niedermann')
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_22_23.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_22_23.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_22_23.java
index db4005ef..4addcf29 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_22_23.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_22_23.java
@@ -18,6 +18,7 @@ import java.util.Collection;
import java.util.Objects;
import java.util.stream.Collectors;
+import it.niedermann.owncloud.notes.persistence.ApiProvider;
import it.niedermann.owncloud.notes.persistence.entity.Account;
import it.niedermann.owncloud.notes.shared.model.ApiVersion;
@@ -45,17 +46,18 @@ public class Migration_22_23 extends Migration {
}
private static void sanitizeAccounts(@NonNull SupportSQLiteDatabase db) {
- final Cursor cursor = db.query("SELECT ID, APIVERSION FROM ACCOUNTS", null);
+ final Cursor cursor = db.query("SELECT id, apiVersion FROM ACCOUNT", null);
final ContentValues values = new ContentValues(1);
- final int COLUMN_POSITION_ID = cursor.getColumnIndex("ID");
- final int COLUMN_POSITION_APIVERSION = cursor.getColumnIndex("APIVERSION");
+ final int COLUMN_POSITION_ID = cursor.getColumnIndex("id");
+ final int COLUMN_POSITION_API_VERSION = cursor.getColumnIndex("apiVersion");
while (cursor.moveToNext()) {
- values.put("APIVERSION", sanitizeApiVersion(cursor.getString(COLUMN_POSITION_APIVERSION)));
+ values.put("APIVERSION", sanitizeApiVersion(cursor.getString(COLUMN_POSITION_API_VERSION)));
db.update("ACCOUNT", OnConflictStrategy.REPLACE, values, "ID = ?", new String[]{String.valueOf(cursor.getLong(COLUMN_POSITION_ID))});
}
cursor.close();
+ ApiProvider.invalidateAPICache();
}
@Nullable