Skip to content

Commit

Permalink
Clear database from FOSS4G Prizren 2023.
Browse files Browse the repository at this point in the history
+ Related database state: eac94c4.
  • Loading branch information
johnjohndoe committed Jun 3, 2024
1 parent 6a99a6d commit bc24e4a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onCreate(db);
}
if (oldVersion < 6) {
// Clear database from rC3 NOWHERE 12/2021 & 36C3 2019.
// Clear database from rC3 NOWHERE 12/2021 & 36C3 2019 & FOSS4G Prizren 2023.
db.execSQL("DROP TABLE IF EXISTS " + AlarmsTable.NAME);
onCreate(db);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void onCreate(SQLiteDatabase db) {

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Clear database from 36C3 2019.
// Clear database from 36C3 2019 & FOSS4G Prizren 2023.
db.execSQL("DROP TABLE IF EXISTS " + HighlightsTable.NAME);
onCreate(db);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onCreate(db);
}
if (oldVersion < 9) {
boolean columnExists = SQLiteDatabaseExtensions.columnExists(db, MetasTable.NAME, Columns.SCHEDULE_LAST_MODIFIED);
if (!columnExists) {
db.execSQL("ALTER TABLE " + MetasTable.NAME + " ADD COLUMN " +
Columns.SCHEDULE_LAST_MODIFIED + " TEXT DEFAULT ''");
}
// Clear database from FOSS4G Prizren 2023.
db.execSQL("DROP TABLE IF EXISTS " + MetasTable.NAME);
onCreate(db);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public class SessionsDBOpenHelper extends SQLiteOpenHelper {

private static final int DATABASE_VERSION = 15;
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 @@ -127,44 +127,11 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onCreate(db);
}
if (oldVersion < 9) {
// Clear database from 35C3 & Camp 2019.
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) {
boolean columnExists = SQLiteDatabaseExtensions.columnExists(db, SessionsTable.NAME, Columns.TIME_ZONE_OFFSET);
if (!columnExists) {
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);
// Clear database from FOSS4G Prizren 2023.
db.execSQL("DROP TABLE IF EXISTS " + SessionByNotificationIdTable.NAME);
onCreate(db);
}
if (oldVersion < 13) {
// Clear database from rC3 NOWHERE 12/2021 & 36C3 2019.
db.execSQL("DROP TABLE IF EXISTS " + SessionsTable.NAME);
db.execSQL("DROP TABLE IF EXISTS " + SessionByNotificationIdTable.NAME);
onCreate(db);
}
if (oldVersion < 14) {
boolean columnExists = SQLiteDatabaseExtensions.columnExists(db, SessionsTable.NAME, Columns.ROOM_IDENTIFIER);
if (!columnExists) {
db.execSQL("ALTER TABLE " + SessionsTable.NAME + " ADD COLUMN " + Columns.ROOM_IDENTIFIER + " TEXT DEFAULT ''");
}
}
if (oldVersion < 15) {
boolean columnExists = SQLiteDatabaseExtensions.columnExists(db, SessionsTable.NAME, Columns.FEEDBACK_URL);
if (!columnExists) {
db.execSQL("ALTER TABLE " + SessionsTable.NAME + " ADD COLUMN " + Columns.FEEDBACK_URL + " TEXT DEFAULT NULL");
}
}


}
}

0 comments on commit bc24e4a

Please sign in to comment.