Gracefully handle package downgrade (fix #350)

Этот коммит содержится в:
Olivier Girondel
2018-09-04 14:30:09 +02:00
родитель 0b4c4cccc6
Коммит dcb60ab75e
+5
Просмотреть файл
@@ -90,6 +90,11 @@ public class DatabaseHelper extends SQLiteOpenHelper {
onCreate(db); onCreate(db);
} }
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS position;");
onCreate(db);
}
public void insertPosition(Position position) { public void insertPosition(Position position) {
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put("deviceId", position.getDeviceId()); values.put("deviceId", position.getDeviceId());