databaseDriver

fun databaseDriver(context: Context, dbName: String, passphrase: ByteArray? = null, schema: SqlSchema<QueryResult.Value<Unit>>, config: DriverConfigurationBuilder.() -> Unit = {}): SqlDriver
fun databaseDriver(driverUri: String?, dbName: String, schema: SqlSchema<QueryResult.Value<Unit>>, passphrase: ByteArray? = null, config: DriverConfigurationBuilder.() -> Unit = {}): SqlDriver

Parameters

passphrase

SQLCipher's raw-key form, x'<64 hex digits>', which encrypts the database, or on iOS the raw-key form with the salt, which encrypts it behind a readable header, see requireSqlCipherKey and setSqlCipherKey. Null or empty leaves the database unencrypted; the backup export uses an empty one for its plain copy.

fun databaseDriver(uri: String, schema: SqlSchema<QueryResult.Value<Unit>>? = null, config: DriverConfigurationBuilder.() -> Unit = {}): SqlDriver

Creates a JVM SQLite driver with optional SQLDelight-managed schema initialization.

Behavior:

  • When schema is provided: SQLDelight will create or migrate the database to schema.version and update PRAGMA user_version.

  • When schema is null: a raw driver is returned and the caller is responsible for schema creation and/or migration.

Use the raw mode only for special flows that intentionally control migration externally (for example import/backup flows).