From 8d6088766ff4cdfaf8348bb862f82b93848354cb Mon Sep 17 00:00:00 2001 From: eho Date: Sun, 29 Apr 2018 19:34:21 +0200 Subject: [PATCH] util: Increment database version number. Update onUpgrade handling(). Since we introduced a new database table in v1.0.7 we need to run onCreate() on all devices updating the app. Since we havent done any actual modifications to the existing tables we dont need to drop them on upgrade though. --- .../main/java/no/aegisdynamics/habitat/util/DbHelper.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/no/aegisdynamics/habitat/util/DbHelper.java b/app/src/main/java/no/aegisdynamics/habitat/util/DbHelper.java index 4ec90b1..8e8ba01 100644 --- a/app/src/main/java/no/aegisdynamics/habitat/util/DbHelper.java +++ b/app/src/main/java/no/aegisdynamics/habitat/util/DbHelper.java @@ -12,7 +12,7 @@ public class DbHelper extends SQLiteOpenHelper implements DeviceDataContract { private static final String DB_NAME = "habitat.db"; - private static final int DB_VERSION = 3; + private static final int DB_VERSION = 4; public DbHelper(Context context) { super(context, DB_NAME, null, DB_VERSION); @@ -40,8 +40,6 @@ public void onCreate(SQLiteDatabase sqLiteDatabase) { @Override public void onUpgrade(SQLiteDatabase sqLiteDatabase, int previousVersion, int newVersion) { - sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + TABLE_AUTOMATION); - sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + TABLE_LOG); onCreate(sqLiteDatabase); } -} \ No newline at end of file +}