mirror of
https://github.com/FossifyOrg/Notes.git
synced 2026-06-11 18:19:15 -04:00
update the logic at upgrading db versions, fix #46
This commit is contained in:
@@ -41,9 +41,10 @@ class DBHelper private constructor(private val mContext: Context) : SQLiteOpenHe
|
||||
}
|
||||
|
||||
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
if (newVersion == 2)
|
||||
if (oldVersion < 2)
|
||||
db.execSQL("ALTER TABLE $TABLE_NAME ADD COLUMN $COL_TYPE INTEGER DEFAULT 0")
|
||||
else if (newVersion == 3)
|
||||
|
||||
if (oldVersion < 3)
|
||||
db.execSQL("ALTER TABLE $TABLE_NAME ADD COLUMN $COL_PATH TEXT")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user