db version up and migration

This commit is contained in:
Sergey Zorchenko 2022-06-20 12:43:40 +03:00
parent 1588df7ffe
commit a0f4361e72
2 changed files with 8 additions and 1 deletions

View file

@ -6,7 +6,7 @@ import androidx.room.TypeConverters
import info.nightscout.androidaps.database.daos.*
import info.nightscout.androidaps.database.entities.*
const val DATABASE_VERSION = 21
const val DATABASE_VERSION = 22
@Database(version = DATABASE_VERSION,
entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,

View file

@ -27,6 +27,7 @@ open class DatabaseModule {
// .addMigrations(migration7to8)
// .addMigrations(migration11to12)
.addMigrations(migration20to21)
.addMigrations(migration21to22)
.addCallback(object : Callback() {
override fun onOpen(db: SupportSQLiteDatabase) {
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")
}
}
}