specify the new db version at upgrade conditions

This commit is contained in:
tibbi 2016-11-21 19:53:28 +01:00
parent e50c4f600f
commit 7a9cabe2e8
1 changed files with 2 additions and 1 deletions

View File

@ -38,6 +38,7 @@ class DBHelper private constructor(private val mContext: Context) : SQLiteOpenHe
} }
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) { override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
if (newVersion == 2)
db.execSQL("ALTER TABLE $TABLE_NAME ADD COLUMN $COL_TYPE INTEGER DEFAULT 0") db.execSQL("ALTER TABLE $TABLE_NAME ADD COLUMN $COL_TYPE INTEGER DEFAULT 0")
} }