Hi, is there a way to programmatically set the dat...
# squarelibraries
m
Hi, is there a way to programmatically set the database max size for sqlidelight in multiplatform?
c
What does 'max size' mean here? Number of rows? Rows * columns? File size? If you're looking to emulate Android's
maximumSize
then you can just copy over the PRAGMA queries it uses and execute them against your driver: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/database/sqlite/SQLiteDatabase.java;l=1296
m
File size. I found there's a callback that returning SupportSQLiteDatabase when creating the driver for each target. is it safe to assume I can set the size inside the callback?
Copy code
return AndroidSqliteDriver(
    schema = AppDatabase.Schema,
    context = argument as Context,
    name = "mylocal.db",
    callback = object : AndroidSqliteDriver.Callback(AppDatabase.Schema) {
        override fun onOpen(db: SupportSQLiteDatabase) {
            db.setForeignKeyConstraintsEnabled(true)
            db.setMaximumSize(1024)
        }
    }
)
something like this