mirror of
https://github.com/nacabaro/vbhelper.git
synced 2026-01-27 16:05:32 +00:00
Started working in database initialization NOT WORKING YET
This commit is contained in:
parent
187ac970de
commit
e9eedb7429
@ -0,0 +1,30 @@
|
|||||||
|
package com.github.nacabaro.vbhelper.database
|
||||||
|
|
||||||
|
import androidx.room.Database
|
||||||
|
import com.github.nacabaro.vbhelper.domain.Dim
|
||||||
|
import com.github.nacabaro.vbhelper.domain.DimProgress
|
||||||
|
import com.github.nacabaro.vbhelper.domain.Evolutions
|
||||||
|
import com.github.nacabaro.vbhelper.domain.Mon
|
||||||
|
import com.github.nacabaro.vbhelper.domain.User
|
||||||
|
import com.github.nacabaro.vbhelper.domain.UserHealthData
|
||||||
|
import com.github.nacabaro.vbhelper.domain.UserMonsters
|
||||||
|
import com.github.nacabaro.vbhelper.domain.UserMonstersSpecialMissions
|
||||||
|
import com.github.nacabaro.vbhelper.domain.UserStepsData
|
||||||
|
|
||||||
|
@Database(
|
||||||
|
version = 1,
|
||||||
|
entities = [
|
||||||
|
Dim::class,
|
||||||
|
DimProgress::class,
|
||||||
|
Evolutions::class,
|
||||||
|
Mon::class,
|
||||||
|
User::class,
|
||||||
|
UserHealthData::class,
|
||||||
|
UserMonsters::class,
|
||||||
|
UserMonstersSpecialMissions::class,
|
||||||
|
UserStepsData::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
abstract class AppDatabase {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package com.github.nacabaro.vbhelper.di
|
||||||
|
|
||||||
|
import com.github.nacabaro.vbhelper.database.AppDatabase.AppDatabase
|
||||||
|
|
||||||
|
interface AppContainer {
|
||||||
|
val db: AppDatabase
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
import android.content.Context
|
||||||
|
import androidx.room.Room
|
||||||
|
import com.github.nacabaro.vbhelper.database.AppDatabase.AppDatabase
|
||||||
|
import com.github.nacabaro.vbhelper.di.AppContainer
|
||||||
|
|
||||||
|
class DefaultAppContainer(private val context: Context) : AppContainer {
|
||||||
|
override val db: AppDatabase by lazy {
|
||||||
|
Room.databaseBuilder(
|
||||||
|
context = context,
|
||||||
|
AppDatabase::class.java,
|
||||||
|
"internalDb"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user