harry.singh
04/07/2021, 11:18 PM//Module A
sqldelight {
MyDatabase {
packageName = "com.package.name.A"
}
}
//Module B
sqldelight {
MyDatabase {
packageName = "com.package.name.B"
dependency project(':moduleA')
}
}
Module A have a single table which is accessed at app startup in the Application class. Module B have 2 tables and this module is dependent on table from Module A. The tables from Module B are accessed when the launcher activity has finished launching.
I create instance of MyDatabase
separately in each of the module:
MyDatabase(AndroidSqliteDriver(MyDatabase.Schema), context)
Now, when I launch the application, I see two instances of database in Android Studio's Database Inspector. First instance have only single table from Module A with the data inserted at Application class. Second instance, have 3 tables, 2 from Module B and 1 from Module A. The Module A table in second instance is empty.
Since, the name of the database is same in both of the modules, I expected only one database instance to have been created with each module creating tables in the same instance. Is there a way to setup SQLDelight to create only a single instance of the database for the application?