Skip to content

Commit

Permalink
Fix local db version to avoid crash during app upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed Aug 5, 2024
1 parent 1d6c53c commit 2a49194
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ abstract class NextcloudDatabase : RoomDatabase() {
abstract fun fileDao(): FileDao

companion object {
const val FIRST_ROOM_DB_VERSION = 65
//NMC customization
//NMC play store version 7.21.9 had db version 64 before SqLite to Room migration
//Keeping it 65(as per NC) will lead to crash when user tried to upgrade the app
const val FIRST_ROOM_DB_VERSION = 64
private var INSTANCE: NextcloudDatabase? = null

@JvmStatic
Expand Down
14 changes: 14 additions & 0 deletions app/src/test/java/com/nmc/DatabaseVersionTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.nmc

import com.nextcloud.client.database.NextcloudDatabase
import org.junit.Test

class DatabaseVersionTest {

@Test
fun validateDatabaseVersion() {
//for NMC the version will start from 64 only
//validating via test case to check if any test changes done during rebasing or merging
assert(64 == NextcloudDatabase.FIRST_ROOM_DB_VERSION)
}
}

0 comments on commit 2a49194

Please sign in to comment.