mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-19 15:34:26 +01:00
Fixed room migration issue
This commit is contained in:
@@ -3,8 +3,14 @@ package no.nordicsemi.android.toolbox.lib.storage
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
|
||||
val MIGRATION_2_3 = object : Migration(2, 3) {
|
||||
val MIGRATION_1_2 = object : Migration(1, 2) {
|
||||
override fun migrate(db: SupportSQLiteDatabase) {
|
||||
// Empty implementation, because the schema isn't changing.
|
||||
// Empty if no schema change
|
||||
}
|
||||
}
|
||||
|
||||
val MIGRATION_2_3 = object : Migration(2, 3) {
|
||||
override fun migrate(db: SupportSQLiteDatabase) {
|
||||
// Empty if no schema change
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import no.nordicsemi.android.toolbox.lib.storage.ConfigurationDatabase
|
||||
import no.nordicsemi.android.toolbox.lib.storage.MIGRATION_1_2
|
||||
import no.nordicsemi.android.toolbox.lib.storage.MIGRATION_2_3
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@@ -21,6 +23,8 @@ class DbHiltModule {
|
||||
context,
|
||||
ConfigurationDatabase::class.java,
|
||||
"toolbox_uart.db"
|
||||
).build()
|
||||
)
|
||||
.addMigrations(MIGRATION_1_2, MIGRATION_2_3)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user