Advertisement
Guest User

Untitled

a guest
May 16th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.75 KB | None | 0 0
  1. @Provides
  2.     @Singleton
  3.     fun providesDatabase(): AppDatabase {
  4.         Timber.d("DB_ACCESS - Provided database here")
  5.  
  6.         return Room.databaseBuilder(
  7.             app,
  8.             AppDatabase::class.java,
  9.             SEEZ_APP_DB_NAME
  10.         ).addCallback(object : RoomDatabase.Callback() {
  11.             override fun onCreate(db: SupportSQLiteDatabase) {
  12.                 super.onCreate(db)
  13.  
  14.                 Timber.d("Database created")
  15.             }
  16.  
  17.             override fun onOpen(db: SupportSQLiteDatabase) {
  18.                 super.onOpen(db)
  19.                 Timber.d("Database open")
  20.             }
  21.         })
  22. //            .addMigrations(MIGRATION_3_4, MIGRATION_4_5 )
  23.             .fallbackToDestructiveMigration()
  24.             .build()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement