From 1646edffd17171c6ba71bd5d7ba53bde7256e2d9 Mon Sep 17 00:00:00 2001 From: Tobias Preuss Date: Sat, 6 Jan 2024 21:58:02 +0100 Subject: [PATCH] Clear database from FOSDEM 2023. + Related commit: a4d723ffbbb86e108203017bcef98834f2d92e27. --- .../database/sqliteopenhelper/AlarmsDBOpenHelper.java | 7 ++++++- .../database/sqliteopenhelper/HighlightDBOpenHelper.java | 2 +- .../database/sqliteopenhelper/MetaDBOpenHelper.java | 7 ++++++- .../database/sqliteopenhelper/SessionsDBOpenHelper.java | 8 ++++---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/AlarmsDBOpenHelper.java b/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/AlarmsDBOpenHelper.java index 4915eaa4d6..dd33b62047 100644 --- a/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/AlarmsDBOpenHelper.java +++ b/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/AlarmsDBOpenHelper.java @@ -10,7 +10,7 @@ public class AlarmsDBOpenHelper extends SQLiteOpenHelper { - private static final int DATABASE_VERSION = 6; + private static final int DATABASE_VERSION = 11; private static final String DATABASE_NAME = "alarms"; @@ -62,5 +62,10 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + AlarmsTable.NAME); onCreate(db); } + if (oldVersion < 11) { + // Clear database from FOSDEM 2023. + db.execSQL("DROP TABLE IF EXISTS " + AlarmsTable.NAME); + onCreate(db); + } } } diff --git a/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/HighlightDBOpenHelper.java b/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/HighlightDBOpenHelper.java index 3a40abb3a9..87c68c158a 100644 --- a/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/HighlightDBOpenHelper.java +++ b/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/HighlightDBOpenHelper.java @@ -11,7 +11,7 @@ public class HighlightDBOpenHelper extends SQLiteOpenHelper { - private static final int DATABASE_VERSION = 5; + private static final int DATABASE_VERSION = 10; private static final String DATABASE_NAME = "highlight"; diff --git a/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/MetaDBOpenHelper.java b/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/MetaDBOpenHelper.java index bbc1d5581f..20f72ebcc9 100644 --- a/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/MetaDBOpenHelper.java +++ b/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/MetaDBOpenHelper.java @@ -13,7 +13,7 @@ public class MetaDBOpenHelper extends SQLiteOpenHelper { - private static final int DATABASE_VERSION = 9; + private static final int DATABASE_VERSION = 12; private static final String DATABASE_NAME = "meta"; @@ -73,5 +73,10 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Columns.SCHEDULE_LAST_MODIFIED + " TEXT DEFAULT ''"); } } + if (oldVersion < 12) { + // Clear database from FOSDEM 2023. + db.execSQL("DROP TABLE IF EXISTS " + MetasTable.NAME); + onCreate(db); + } } } diff --git a/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/SessionsDBOpenHelper.java b/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/SessionsDBOpenHelper.java index 5e76eedf67..828be9217d 100644 --- a/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/SessionsDBOpenHelper.java +++ b/database/src/main/java/info/metadude/android/eventfahrplan/database/sqliteopenhelper/SessionsDBOpenHelper.java @@ -159,10 +159,10 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } } 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"); - } + // Clear database from FOSDEM 2023. + db.execSQL("DROP TABLE IF EXISTS " + SessionsTable.NAME); + db.execSQL("DROP TABLE IF EXISTS " + SessionByNotificationIdTable.NAME); + onCreate(db); }