From 91ef307e7a1a32e32a9528ec187d92efa2a2afb9 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Mon, 9 Dec 2019 13:11:45 +0100 Subject: [PATCH] Fix database migration of field forceOverwrite to NameCollisionPolicy Signed-off-by: Alice Gaudon --- .../com/owncloud/android/files/services/FileUploader.java | 7 +++++-- .../owncloud/android/providers/FileContentProvider.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/owncloud/android/files/services/FileUploader.java b/src/main/java/com/owncloud/android/files/services/FileUploader.java index 1e50f85806..ad61edd662 100644 --- a/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -1053,10 +1053,13 @@ public class FileUploader extends Service } + /** + * Ordinal of enumerated constants is important for old data compatibility. + */ public enum NameCollisionPolicy { + RENAME, // Ordinal corresponds to old forceOverwrite = false (0 in database) + OVERWRITE, // Ordinal corresponds to old forceOverwrite = true (1 in database) CANCEL, - RENAME, - OVERWRITE, ASK_USER; public static final NameCollisionPolicy DEFAULT = RENAME; diff --git a/src/main/java/com/owncloud/android/providers/FileContentProvider.java b/src/main/java/com/owncloud/android/providers/FileContentProvider.java index 6959a5c2ad..3fd9a3af48 100644 --- a/src/main/java/com/owncloud/android/providers/FileContentProvider.java +++ b/src/main/java/com/owncloud/android/providers/FileContentProvider.java @@ -2147,7 +2147,7 @@ public class FileContentProvider extends ContentProvider { ProviderTableMeta.UPLOADS_STATUS + ", " + ProviderTableMeta.UPLOADS_LOCAL_BEHAVIOUR + ", " + ProviderTableMeta.UPLOADS_UPLOAD_TIME + ", " + - "force_overwrite" + ", " + + "force_overwrite" + ", " + // See FileUploader.NameCollisionPolicy ProviderTableMeta.UPLOADS_IS_CREATE_REMOTE_FOLDER + ", " + ProviderTableMeta.UPLOADS_UPLOAD_END_TIMESTAMP + ", " + ProviderTableMeta.UPLOADS_LAST_RESULT + ", " +