2022-08-14 13:29:05 +05:30
|
|
|
package com.github.libretube.db
|
2022-08-13 23:34:07 +05:30
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import androidx.room.Room
|
|
|
|
import com.github.libretube.DATABASE_NAME
|
|
|
|
|
|
|
|
object DatabaseHolder {
|
2022-08-14 13:29:05 +05:30
|
|
|
lateinit var db: AppDatabase
|
2022-08-13 23:34:07 +05:30
|
|
|
|
|
|
|
fun initializeDatabase(context: Context) {
|
2022-08-14 13:29:05 +05:30
|
|
|
db = Room.databaseBuilder(
|
2022-08-13 23:34:07 +05:30
|
|
|
context,
|
|
|
|
AppDatabase::class.java,
|
|
|
|
DATABASE_NAME
|
2022-08-14 01:33:11 +05:30
|
|
|
)
|
2022-08-14 20:06:18 +05:30
|
|
|
.fallbackToDestructiveMigration()
|
2022-08-14 01:33:11 +05:30
|
|
|
.build()
|
2022-08-13 23:34:07 +05:30
|
|
|
}
|
|
|
|
}
|