Remove helper version variable from DBHelper migration code

This commit is contained in:
Ensar Sarajčić 2023-09-04 10:06:24 +02:00
parent 3ed178c2f5
commit e0143bebbb

View file

@ -49,10 +49,8 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
}
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
var version = oldVersion
if (version == 1 && newVersion > version) {
if (oldVersion == 1 && newVersion > oldVersion) {
db.execSQL("ALTER TABLE $ALARMS_TABLE_NAME ADD COLUMN $COL_ONE_SHOT INTEGER NOT NULL DEFAULT 0")
version++
}
}