Skip to content

Commit

Permalink
Clear database from MRMCD 2023 on upgrade.
Browse files Browse the repository at this point in the history
+ Related database state: 2a9b20c.
  • Loading branch information
johnjohndoe committed Sep 18, 2024
1 parent deccf0e commit 82e6ec9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class AlarmsDBOpenHelper(context: Context) : SQLiteOpenHelper(
) {

private companion object {
const val DATABASE_VERSION = 6
const val DATABASE_VERSION = 9
const val DATABASE_NAME = "alarms"

// language=sql
Expand Down Expand Up @@ -68,6 +68,11 @@ internal class AlarmsDBOpenHelper(context: Context) : SQLiteOpenHelper(
dropTableIfExist(NAME)
onCreate(this)
}
if (oldVersion < 9) {
// Clear database from MRMCD 2023.
dropTableIfExist(NAME)
onCreate(this)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal class HighlightDBOpenHelper(context: Context) : SQLiteOpenHelper(
) {

private companion object {
const val DATABASE_VERSION = 5
const val DATABASE_VERSION = 8
const val DATABASE_NAME = "highlight"

// language=sql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class MetaDBOpenHelper(context: Context) : SQLiteOpenHelper(
) {

private companion object {
const val DATABASE_VERSION = 9
const val DATABASE_VERSION = 10
const val DATABASE_NAME = "meta"

// language=sql
Expand Down Expand Up @@ -75,6 +75,11 @@ internal class MetaDBOpenHelper(context: Context) : SQLiteOpenHelper(
addTextColumn(SCHEDULE_LAST_MODIFIED, default = "")
}
}
if (oldVersion < 10) {
// Clear database from MRMCD 2023.
dropTableIfExist(NAME)
onCreate(this)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ internal class SessionsDBOpenHelper(context: Context) : SQLiteOpenHelper(
) {

private companion object {
const val DATABASE_VERSION = 16
const val DATABASE_VERSION = 12
const val DATABASE_NAME = "lectures" // Keep table name to avoid database migration.

// language=sql
Expand Down Expand Up @@ -274,30 +274,11 @@ internal class SessionsDBOpenHelper(context: Context) : SQLiteOpenHelper(
}
}
if (oldVersion < 12) {
// Clear database from rC3 12/2020.
// Clear database from rC3 12/2020 & MRMCD 2023.
dropTableIfExist(SessionsTable.NAME)
dropTableIfExist(SessionByNotificationIdTable.NAME)
onCreate(this)
}
if (oldVersion < 13) {
// Clear database from rC3 NOWHERE 12/2021 & 36C3 2019.
dropTableIfExist(SessionsTable.NAME)
dropTableIfExist(SessionByNotificationIdTable.NAME)
onCreate(this)
}
if (oldVersion < 14) {
if (!columnExists(SessionsTable.NAME, ROOM_IDENTIFIER)) {
addTextColumn(ROOM_IDENTIFIER, default = "")
}
}
if (oldVersion < 15) {
if (!columnExists(SessionsTable.NAME, FEEDBACK_URL)) {
addTextColumn(FEEDBACK_URL, default = null)
}
}
if (oldVersion < 16) {
execSQL(SCHEDULE_STATISTIC_VIEW_CREATE)
}
}

}
Expand Down

0 comments on commit 82e6ec9

Please sign in to comment.