Skip to content

Commit

Permalink
Clear database from Hackover 2018 on upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjohndoe committed Oct 2, 2019
1 parent ffbb4c4 commit 211d2e6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class AlarmsDBOpenHelper extends SQLiteOpenHelper {

private static final int DATABASE_VERSION = 3;
private static final int DATABASE_VERSION = 7;

private static final String DATABASE_NAME = "alarms";

Expand Down Expand Up @@ -45,5 +45,11 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + AlarmsTable.NAME);
onCreate(db);
}
if (oldVersion < 7) {
// Clear database from Hackover 2018.
db.execSQL("DROP TABLE IF EXISTS " + AlarmsTable.NAME);
onCreate(db);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class HighlightDBOpenHelper extends SQLiteOpenHelper {

private static final int DATABASE_VERSION = 2;
private static final int DATABASE_VERSION = 6;

private static final String DATABASE_NAME = "highlight";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public class LecturesDBOpenHelper extends SQLiteOpenHelper {

private static final int DATABASE_VERSION = 8;
private static final int DATABASE_VERSION = 10;

private static final String DATABASE_NAME = "lectures";

Expand Down Expand Up @@ -106,5 +106,10 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + LecturesTable.NAME);
onCreate(db);
}
if (oldVersion < 10) {
// Clear database from Hackover 2018.
db.execSQL("DROP TABLE IF EXISTS " + LecturesTable.NAME);
onCreate(db);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public class MetaDBOpenHelper extends SQLiteOpenHelper {

private static final int DATABASE_VERSION = 4;
private static final int DATABASE_VERSION = 8;

private static final String DATABASE_NAME = "meta";

Expand Down Expand Up @@ -53,5 +53,10 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + MetasTable.NAME);
onCreate(db);
}
if (oldVersion < 8) {
// Clear database from Hackover 2018.
db.execSQL("DROP TABLE IF EXISTS " + MetasTable.NAME);
onCreate(db);
}
}
}

0 comments on commit 211d2e6

Please sign in to comment.