From 200e2db1f38ad770df98c0b33dbd5736b6d76faa Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 13 Oct 2023 11:42:25 +0200 Subject: [PATCH] migrate to 74 and reset capabilities Signed-off-by: tobiasKaminsky --- .../74.json | 56 +++++++++---------- .../client/database/NextcloudDatabase.kt | 2 + .../database/migrations/Migration73to74.kt | 38 +++++++++++++ .../com/owncloud/android/db/ProviderMeta.java | 2 +- 4 files changed, 66 insertions(+), 32 deletions(-) create mode 100644 app/src/main/java/com/nextcloud/client/database/migrations/Migration73to74.kt diff --git a/app/schemas/com.nextcloud.client.database.NextcloudDatabase/74.json b/app/schemas/com.nextcloud.client.database.NextcloudDatabase/74.json index d37b3654d9..5f8b60cfd6 100644 --- a/app/schemas/com.nextcloud.client.database.NextcloudDatabase/74.json +++ b/app/schemas/com.nextcloud.client.database.NextcloudDatabase/74.json @@ -1,18 +1,18 @@ { "formatVersion": 1, "database": { - "version": 74, - "identityHash": "7e73c045ac6d52d6c7c1626eefbc21e9", - "entities": [ - { - "tableName": "arbitrary_data", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `cloud_id` TEXT, `key` TEXT, `value` TEXT)", - "fields": [ + "version": 74, + "identityHash": "bc3fbd9985959e167fdd38198dd480b5", + "entities": [ { - "fieldPath": "id", - "columnName": "_id", - "affinity": "INTEGER", - "notNull": false + "tableName": "arbitrary_data", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `cloud_id` TEXT, `key` TEXT, `value` TEXT)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false }, { "fieldPath": "cloudId", @@ -42,19 +42,19 @@ "indices": [], "foreignKeys": [] }, - { - "tableName": "capabilities", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` TEXT, `version_mayor` INTEGER, `version_minor` INTEGER, `version_micro` INTEGER, `version_string` TEXT, `version_edition` TEXT, `extended_support` INTEGER, `core_pollinterval` INTEGER, `sharing_api_enabled` INTEGER, `sharing_public_enabled` INTEGER, `sharing_public_password_enforced` INTEGER, `sharing_public_expire_date_enabled` INTEGER, `sharing_public_expire_date_days` INTEGER, `sharing_public_expire_date_enforced` INTEGER, `sharing_public_send_mail` INTEGER, `sharing_public_upload` INTEGER, `sharing_user_send_mail` INTEGER, `sharing_resharing` INTEGER, `sharing_federation_outgoing` INTEGER, `sharing_federation_incoming` INTEGER, `files_bigfilechunking` INTEGER, `files_undelete` INTEGER, `files_versioning` INTEGER, `external_links` INTEGER, `server_name` TEXT, `server_color` TEXT, `server_text_color` TEXT, `server_element_color` TEXT, `server_slogan` TEXT, `server_logo` TEXT, `background_url` TEXT, `end_to_end_encryption` INTEGER, `end_to_end_encryption_keys_exist` INTEGER, `activity` INTEGER, `background_default` INTEGER, `background_plain` INTEGER, `richdocument` INTEGER, `richdocument_mimetype_list` TEXT, `richdocument_direct_editing` INTEGER, `richdocument_direct_templates` INTEGER, `richdocument_optional_mimetype_list` TEXT, `sharing_public_ask_for_optional_password` INTEGER, `richdocument_product_name` TEXT, `direct_editing_etag` TEXT, `user_status` INTEGER, `user_status_supports_emoji` INTEGER, `etag` TEXT, `files_locking_version` TEXT, `groupfolders` INTEGER, `drop_account` INTEGER)", - "fields": [ { - "fieldPath": "id", - "columnName": "_id", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "accountName", - "columnName": "account", + "tableName": "capabilities", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` TEXT, `version_mayor` INTEGER, `version_minor` INTEGER, `version_micro` INTEGER, `version_string` TEXT, `version_edition` TEXT, `extended_support` INTEGER, `core_pollinterval` INTEGER, `sharing_api_enabled` INTEGER, `sharing_public_enabled` INTEGER, `sharing_public_password_enforced` INTEGER, `sharing_public_expire_date_enabled` INTEGER, `sharing_public_expire_date_days` INTEGER, `sharing_public_expire_date_enforced` INTEGER, `sharing_public_send_mail` INTEGER, `sharing_public_upload` INTEGER, `sharing_user_send_mail` INTEGER, `sharing_resharing` INTEGER, `sharing_federation_outgoing` INTEGER, `sharing_federation_incoming` INTEGER, `files_bigfilechunking` INTEGER, `files_undelete` INTEGER, `files_versioning` INTEGER, `external_links` INTEGER, `server_name` TEXT, `server_color` TEXT, `server_text_color` TEXT, `server_element_color` TEXT, `server_slogan` TEXT, `server_logo` TEXT, `background_url` TEXT, `end_to_end_encryption` INTEGER, `end_to_end_encryption_keys_exist` INTEGER, `activity` INTEGER, `background_default` INTEGER, `background_plain` INTEGER, `richdocument` INTEGER, `richdocument_mimetype_list` TEXT, `richdocument_direct_editing` INTEGER, `richdocument_direct_templates` INTEGER, `richdocument_optional_mimetype_list` TEXT, `sharing_public_ask_for_optional_password` INTEGER, `richdocument_product_name` TEXT, `direct_editing_etag` TEXT, `user_status` INTEGER, `user_status_supports_emoji` INTEGER, `etag` TEXT, `files_locking_version` TEXT, `groupfolders` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "accountName", + "columnName": "account", "affinity": "TEXT", "notNull": false }, @@ -345,12 +345,6 @@ "columnName": "groupfolders", "affinity": "INTEGER", "notNull": false - }, - { - "fieldPath": "dropAccount", - "columnName": "drop_account", - "affinity": "INTEGER", - "notNull": false } ], "primaryKey": { @@ -1155,7 +1149,7 @@ "views": [], "setupQueries": [ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", - "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '7e73c045ac6d52d6c7c1626eefbc21e9')" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'bc3fbd9985959e167fdd38198dd480b5')" ] } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/nextcloud/client/database/NextcloudDatabase.kt b/app/src/main/java/com/nextcloud/client/database/NextcloudDatabase.kt index 556acc6422..a0a97ae0a5 100644 --- a/app/src/main/java/com/nextcloud/client/database/NextcloudDatabase.kt +++ b/app/src/main/java/com/nextcloud/client/database/NextcloudDatabase.kt @@ -42,6 +42,7 @@ import com.nextcloud.client.database.entity.UploadEntity import com.nextcloud.client.database.entity.VirtualEntity import com.nextcloud.client.database.migrations.Migration67to68 import com.nextcloud.client.database.migrations.Migration70to71 +import com.nextcloud.client.database.migrations.Migration73to74 import com.nextcloud.client.database.migrations.RoomMigration import com.nextcloud.client.database.migrations.addLegacyMigrations import com.owncloud.android.db.ProviderMeta @@ -96,6 +97,7 @@ abstract class NextcloudDatabase : RoomDatabase() { .addMigrations(RoomMigration()) .addMigrations(Migration67to68()) .addMigrations(Migration70to71()) + .addMigrations(Migration73to74()) .fallbackToDestructiveMigration() .build() } diff --git a/app/src/main/java/com/nextcloud/client/database/migrations/Migration73to74.kt b/app/src/main/java/com/nextcloud/client/database/migrations/Migration73to74.kt new file mode 100644 index 0000000000..afb1f7d398 --- /dev/null +++ b/app/src/main/java/com/nextcloud/client/database/migrations/Migration73to74.kt @@ -0,0 +1,38 @@ +/* + * Nextcloud Android client application + * + * @author Álvaro Brey + * Copyright (C) 2023 Álvaro Brey + * Copyright (C) 2023 Nextcloud GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this program. If not, see . + * + */ + +package com.nextcloud.client.database.migrations + +import androidx.room.migration.Migration +import androidx.sqlite.db.SupportSQLiteDatabase + +/** + * Migration from version 73 to 74. + * + * resets capabilities to show groupfolder + */ +@Suppress("MagicNumber") +class Migration73to74 : Migration(73, 74) { + override fun migrate(database: SupportSQLiteDatabase) { + DatabaseMigrationUtil.resetCapabilities(database) + } +} diff --git a/app/src/main/java/com/owncloud/android/db/ProviderMeta.java b/app/src/main/java/com/owncloud/android/db/ProviderMeta.java index e1c207e47b..bf2f8417e5 100644 --- a/app/src/main/java/com/owncloud/android/db/ProviderMeta.java +++ b/app/src/main/java/com/owncloud/android/db/ProviderMeta.java @@ -35,7 +35,7 @@ import java.util.List; */ public class ProviderMeta { public static final String DB_NAME = "filelist"; - public static final int DB_VERSION = 73; + public static final int DB_VERSION = 74; private ProviderMeta() { // No instance