Skip to content

Commit

Permalink
Clear database from KotlinConf 2019 on upgrade.
Browse files Browse the repository at this point in the history
+ Related commit: afcc6a1.
  • Loading branch information
johnjohndoe committed Mar 28, 2023
1 parent 813d241 commit da2cc24
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public class AlarmsDBOpenHelper extends SQLiteOpenHelper {

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

private static final String DATABASE_NAME = "alarms";

Expand Down Expand Up @@ -48,17 +48,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onCreate(db);
}
if (oldVersion < 4) {
// Clear database from 35C3.
db.execSQL("DROP TABLE IF EXISTS " + AlarmsTable.NAME);
onCreate(db);
}
if (oldVersion < 5) {
// Clear database from rC3 12/2020.
db.execSQL("DROP TABLE IF EXISTS " + AlarmsTable.NAME);
onCreate(db);
}
if (oldVersion < 6) {
// Clear database from rC3 NOWHERE 12/2021.
// Clear database from 35C3 && KotlinConf 2019.
db.execSQL("DROP TABLE IF EXISTS " + AlarmsTable.NAME);
onCreate(db);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class HighlightDBOpenHelper extends SQLiteOpenHelper {

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

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 MetaDBOpenHelper extends SQLiteOpenHelper {

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

private static final String DATABASE_NAME = "meta";

Expand Down Expand Up @@ -50,17 +50,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onCreate(db);
}
if (oldVersion < 5) {
// Clear database from 35C3.
db.execSQL("DROP TABLE IF EXISTS " + MetasTable.NAME);
onCreate(db);
}
if (oldVersion < 7) {
// Clear database from rC3 12/2020.
db.execSQL("DROP TABLE IF EXISTS " + MetasTable.NAME);
onCreate(db);
}
if (oldVersion < 8) {
// Clear database from rC3 NOWHERE 12/2021.
// Clear database from 35C3 & KotlinConf 2019.
db.execSQL("DROP TABLE IF EXISTS " + MetasTable.NAME);
onCreate(db);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

public class SessionsDBOpenHelper extends SQLiteOpenHelper {

private static final int DATABASE_VERSION = 13;
private static final int DATABASE_VERSION = 9;

private static final String DATABASE_NAME = "lectures"; // Keep table name to avoid database migration.

Expand Down Expand Up @@ -124,24 +124,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onCreate(db);
}
if (oldVersion < 9) {
// Clear database from 35C3.
db.execSQL("DROP TABLE IF EXISTS " + SessionsTable.NAME);
onCreate(db);
}
if (oldVersion < 10 && newVersion >= 10) {
db.execSQL(SESSION_BY_NOTIFICATION_ID_TABLE_CREATE);
}
if (oldVersion < 11 && newVersion >= 11) {
db.execSQL("ALTER TABLE " + SessionsTable.NAME + " ADD COLUMN " + Columns.TIME_ZONE_OFFSET + " INTEGER DEFAULT NULL");
}
if (oldVersion < 12) {
// Clear database from rC3 12/2020.
db.execSQL("DROP TABLE IF EXISTS " + SessionsTable.NAME);
db.execSQL("DROP TABLE IF EXISTS " + SessionByNotificationIdTable.NAME);
onCreate(db);
}
if (oldVersion < 13) {
// Clear database from rC3 NOWHERE 12/2021.
// Clear database from 35C3 & KotlinConf 2019.
db.execSQL("DROP TABLE IF EXISTS " + SessionsTable.NAME);
db.execSQL("DROP TABLE IF EXISTS " + SessionByNotificationIdTable.NAME);
onCreate(db);
Expand Down

0 comments on commit da2cc24

Please sign in to comment.