kopia lustrzana https://github.com/ge0rg/aprsdroid
outsource resetting of positions table
rodzic
5047ea7df4
commit
a50e18d987
|
@ -91,11 +91,7 @@ class StorageDatabase(context : Context) extends
|
|||
db.execSQL(Position.TABLE_CREATE)
|
||||
Array("call", "lat", "lon").map(col => db.execSQL(Position.TABLE_INDEX.format(col, col)))
|
||||
}
|
||||
override def onUpgrade(db: SQLiteDatabase, from : Int, to : Int) {
|
||||
if (from == 1 && to >= 2) {
|
||||
db.execSQL("ALTER TABLE %s ADD COLUMN %s".format(Post.TABLE, "TYPE INTEGER DEFAULT 0"))
|
||||
}
|
||||
if (from <= 4 && to >= 3) {
|
||||
def resetPositionsTable(db : SQLiteDatabase) {
|
||||
db.execSQL(Position.TABLE_DROP)
|
||||
db.execSQL(Position.TABLE_CREATE)
|
||||
Array("call", "lat", "lon").map(col => db.execSQL(Position.TABLE_INDEX.format(col, col)))
|
||||
|
@ -111,6 +107,15 @@ class StorageDatabase(context : Context) extends
|
|||
}
|
||||
c.close()
|
||||
}
|
||||
def resetPositionsTable() : Unit = resetPositionsTable(getWritableDatabase())
|
||||
|
||||
override def onUpgrade(db: SQLiteDatabase, from : Int, to : Int) {
|
||||
if (from == 1 && to >= 2) {
|
||||
db.execSQL("ALTER TABLE %s ADD COLUMN %s".format(Post.TABLE, "TYPE INTEGER DEFAULT 0"))
|
||||
}
|
||||
if (from <= 4 && to >= 3) {
|
||||
resetPositionsTable(db)
|
||||
}
|
||||
}
|
||||
|
||||
def trimPosts(ts : Long) {
|
||||
|
|
Ładowanie…
Reference in New Issue