Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
util: Only create database tables if they dont already exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
ardevd committed Apr 30, 2018
1 parent 14048a7 commit c3dfed9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/no/aegisdynamics/habitat/util/DbHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public DbHelper(Context context) {
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
// Create tables
sqLiteDatabase.execSQL("CREATE TABLE " + TABLE_AUTOMATION + "("
sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_AUTOMATION + "("
+ FIELD_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ FIELD_AUTOMATION_NAME + " TEXT, "
+ FIELD_AUTOMATION_DESCRIPTION + " TEXT, "
Expand All @@ -30,7 +30,7 @@ public void onCreate(SQLiteDatabase sqLiteDatabase) {
+ FIELD_AUTOMATION_DEVICE + " TEXT, "
+ FIELD_AUTOMATION_COMMANDS + " TEXT);");

sqLiteDatabase.execSQL("CREATE TABLE " + TABLE_LOG + "("
sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_LOG + "("
+ FIELD_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ FIELD_LOG_TAG + " TEXT, "
+ FIELD_LOG_MESSAGE + " TEXT, "
Expand Down

0 comments on commit c3dfed9

Please sign in to comment.