diff --git a/persistence/src/appleMain/kotlin/com/wire/kalium/persistence/db/GlobalDatabaseProvider.kt b/persistence/src/appleMain/kotlin/com/wire/kalium/persistence/db/GlobalDatabaseProvider.kt index c75aaea6812..37188b6d9f0 100644 --- a/persistence/src/appleMain/kotlin/com/wire/kalium/persistence/db/GlobalDatabaseProvider.kt +++ b/persistence/src/appleMain/kotlin/com/wire/kalium/persistence/db/GlobalDatabaseProvider.kt @@ -23,6 +23,7 @@ import app.cash.sqldelight.adapter.primitive.IntColumnAdapter import app.cash.sqldelight.driver.native.NativeSqliteDriver import app.cash.sqldelight.driver.native.wrapConnection import co.touchlab.sqliter.DatabaseConfiguration +import co.touchlab.sqliter.DatabaseManager import com.wire.kalium.persistence.Accounts import com.wire.kalium.persistence.CurrentAccount import com.wire.kalium.persistence.GlobalDatabase @@ -48,17 +49,16 @@ actual class GlobalDatabaseProvider( init { NSFileManager.defaultManager.createDirectoryAtPath(storePath, true, null, null) - val schema = GlobalDatabase.Schema val driver = NativeSqliteDriver( DatabaseConfiguration( name = dbName, - version = schema.version, + version = schema.version.toInt(), create = { connection -> wrapConnection(connection) { schema.create(it) } }, upgrade = { connection, oldVersion, newVersion -> - wrapConnection(connection) { schema.migrate(it, oldVersion, newVersion) } + wrapConnection(connection) { schema.migrate(it, oldVersion.toLong(), newVersion.toLong()) } }, extendedConfig = DatabaseConfiguration.Extended( basePath = storePath diff --git a/persistence/src/appleMain/kotlin/com/wire/kalium/persistence/db/UserDatabase.kt b/persistence/src/appleMain/kotlin/com/wire/kalium/persistence/db/UserDatabase.kt index f76c621c7f3..aa2a2ac0b20 100644 --- a/persistence/src/appleMain/kotlin/com/wire/kalium/persistence/db/UserDatabase.kt +++ b/persistence/src/appleMain/kotlin/com/wire/kalium/persistence/db/UserDatabase.kt @@ -53,13 +53,13 @@ actual fun userDatabaseBuilder( val driver = NativeSqliteDriver( DatabaseConfiguration( name = FileNameUtil.userDBName(userId), - version = schema.version, + version = schema.version.toInt(), journalMode = if (enableWAL) JournalMode.WAL else JournalMode.DELETE, create = { connection -> wrapConnection(connection) { schema.create(it) } }, upgrade = { connection, oldVersion, newVersion -> - wrapConnection(connection) { schema.migrate(it, oldVersion, newVersion) } + wrapConnection(connection) { schema.migrate(it, oldVersion.toLong(), newVersion.toLong()) } }, extendedConfig = DatabaseConfiguration.Extended( basePath = platformDatabaseData.storePath @@ -96,13 +96,13 @@ fun inMemoryDatabase( val driver = NativeSqliteDriver( DatabaseConfiguration( name = FileNameUtil.userDBName(userId), - version = schema.version, + version = schema.version.toInt(), inMemory = true, create = { connection -> wrapConnection(connection) { schema.create(it) } }, upgrade = { connection, oldVersion, newVersion -> - wrapConnection(connection) { schema.migrate(it, oldVersion, newVersion) } + wrapConnection(connection) { schema.migrate(it, oldVersion.toLong(), newVersion.toLong()) } } ) )