db version up and migration
This commit is contained in:
parent
1588df7ffe
commit
a0f4361e72
|
@ -6,7 +6,7 @@ import androidx.room.TypeConverters
|
||||||
import info.nightscout.androidaps.database.daos.*
|
import info.nightscout.androidaps.database.daos.*
|
||||||
import info.nightscout.androidaps.database.entities.*
|
import info.nightscout.androidaps.database.entities.*
|
||||||
|
|
||||||
const val DATABASE_VERSION = 21
|
const val DATABASE_VERSION = 22
|
||||||
|
|
||||||
@Database(version = DATABASE_VERSION,
|
@Database(version = DATABASE_VERSION,
|
||||||
entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
|
entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
|
||||||
|
|
|
@ -27,6 +27,7 @@ open class DatabaseModule {
|
||||||
// .addMigrations(migration7to8)
|
// .addMigrations(migration7to8)
|
||||||
// .addMigrations(migration11to12)
|
// .addMigrations(migration11to12)
|
||||||
.addMigrations(migration20to21)
|
.addMigrations(migration20to21)
|
||||||
|
.addMigrations(migration21to22)
|
||||||
.addCallback(object : Callback() {
|
.addCallback(object : Callback() {
|
||||||
override fun onOpen(db: SupportSQLiteDatabase) {
|
override fun onOpen(db: SupportSQLiteDatabase) {
|
||||||
super.onOpen(db)
|
super.onOpen(db)
|
||||||
|
@ -69,4 +70,10 @@ open class DatabaseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val migration21to22 = object : Migration(21,22) {
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("ALTER TABLE `carbs` ADD COLUMN `notes` TEXT")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue