Skip to content

Foreign Keys

You can enable foreign key constraints for the Android SQLite driver through the driver's onOpen callback.

AndroidSqliteDriver(
  schema = Database.Schema,
  callback = object : AndroidSqliteDriver.Callback(Database.Schema) {
    override fun onOpen(db: SupportSQLiteDatabase) {
      db.setForeignKeyConstraintsEnabled(true)
    }
  }
)