Skip to content

Commit

Permalink
fix: ios driver changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara committed Sep 13, 2023
1 parent 79206ca commit 5374d9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()) }
}
)
)
Expand Down

0 comments on commit 5374d9f

Please sign in to comment.