INNER CODE UNIT · Kotlin

DbOpenHelper

bufferapp/android-clean-architecture-boilerplate · cache/src/main/java/org/buffer/android/boilerplate/cache/db/DbOpenHelper.kt:13

class DbOpenHelper @Inject constructor(context: Context) :
        SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {

    companion object {
        val DATABASE_NAME = "buffer-clean-arch-boilerplate.db"
        val DATABASE_VERSION = 1
    }

    override fun onConfigure(db: SQLiteDatabase) {
        super.onConfigure(db)
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            db.setForeignKeyConstraintsEnabled(true)
        } else {
            db.execSQL("PRAGMA foreign_keys=ON;")
        }
    }

    override fun onCreate(db: SQLiteDatabase) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…