Hey guys. small question. I have successfully done...
# multiplatform
Hey guys. small question. I have successfully done an unencrypted DB migration to an encrypted one using SQLCipher on KMM. I can see this by inspecting the container in xcode. The only issue I have remaining is in our DatabaseRetriever we need to return our Database, that is automatically created by sqlDelight. So I return this:
Copy code
                    name = DatabaseName,
                    version = DatabaseSample.Schema.version,
                    create = { connection -> wrapConnection(connection) { DatabaseSample.Schema.create(it) } },
                    upgrade = { connection, oldVersion, newVersion -> wrapConnection(connection) { DatabaseSample.Schema.migrate(it, oldVersion, newVersion) } },
//                    Workaround for DatabaseConnection.setCipherKey causing an exception on iOS 14
                    configConnection = { connection, _ ->
                        val statement = "PRAGMA key = \"$password\";"
                        connection.withStatement(statement) {
However when I run it, I see migration is done fine, and I have an encrypted db in the container with the old values, however xcode gives me this issue: attempted to run migration and failed. closing connection. Function doesn't have or inherit @Throws annotation and thus exception isn't propagated from Kotlin to Objective-C/Swift as NSError. It is considered unexpected and unhandled instead. Program will be terminated. Uncaught Kotlin exception: kotlin.Exception: android/database/sqlite/SQLiteException - table TestTable already exists (code 1): , while compiling: CREATE TABLE TestTable ( Any ideas on what could fix this?