https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

Ashu

02/24/2023, 7:20 AM
Hi, can I use multiple database files with same schema in KMM using SQL Delight. For my use-case, I am trying to provide multiple user login, I want separate database instances for each user in the same app.
a

Arjan van Wieringen

02/24/2023, 9:05 AM
Are the users going to use the app simultaneously?
a

Ashu

02/24/2023, 10:17 AM
@Arjan van Wieringen Not simultaneously, I don't need multiple db connections at the same time, but need to switch between databases (created with the same schema) when users are switched. For example, in android, I can open database connections to multiple databases with different names by passing database path.
p

psh

02/24/2023, 1:37 PM
When you create the
AndroidSqliteDriver
and the
NativeSqliteDriver
the value you pass for the “name” field determines the DB filename. In theory you could reinitialize, use a new driver instance, and switch files since the Schema parameter is separate from the name.
16 Views