Files
element-x-android/libraries/encrypted-db/build.gradle.kts
T
hayaksi1 362acd6cab Run the database migrations again when a database is upgraded
Upgrading over an older install crashed before the login screen with
`SQLiteException: no such column: SessionData.position`. The session, cache
and push databases were opened at their new schema version but their tables
were never migrated.

`SqlCipherDriverFactory` overrides `AndroidSqliteDriver.Callback.onUpgrade` so
the database key can be replaced, and never called through to the base
implementation - which is the only thing that runs `schema.migrate`. Every
SQLDelight migration in the app was skipped as a result.

The override now calls `super.onUpgrade` after the re-key, so a database that
crosses the re-key version is still re-encrypted before its tables are
migrated. It moved out of an anonymous object into a named `MigrationCallback`
so the behaviour can be tested.

Part of #7509
2026-08-25 21:41:17 +03:00

35 lines
814 B
Kotlin

/*
* Copyright (c) 2025 Element Creations Ltd.
* Copyright 2023-2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
import extension.testCommonDependencies
plugins {
id("io.element.android-library")
}
android {
namespace = "io.element.android.libraries.encrypteddb"
buildTypes {
release {
isMinifyEnabled = false
consumerProguardFiles("consumer-proguard-rules.pro")
}
}
}
dependencies {
implementation(libs.sqldelight.driver.android)
implementation(libs.sqlcipher)
implementation(libs.sqlite)
implementation(libs.google.tink)
implementation(projects.libraries.androidutils)
testCommonDependencies(libs)
}