Skip to content

Commit

Permalink
Clear database from Datenspuren 2023 on upgrade.
Browse files Browse the repository at this point in the history
+ Related database state: 75b3305.
  • Loading branch information
johnjohndoe committed Sep 9, 2024
1 parent 7e7f4cb commit 76418f8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 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 = 12
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 < 12) {
// Clear database from Datenspuren 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 = 11
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 = 13
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 < 13) {
// Clear database from Datenspuren 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 = 15
const val DATABASE_NAME = "lectures" // Keep table name to avoid database migration.

// language=sql
Expand Down Expand Up @@ -291,12 +291,10 @@ internal class SessionsDBOpenHelper(context: Context) : SQLiteOpenHelper(
}
}
if (oldVersion < 15) {
if (!columnExists(SessionsTable.NAME, FEEDBACK_URL)) {
addTextColumn(FEEDBACK_URL, default = null)
}
}
if (oldVersion < 16) {
execSQL(SCHEDULE_STATISTIC_VIEW_CREATE)
// Clear database from Datenspuren 2023.
dropTableIfExist(SessionsTable.NAME)
dropTableIfExist(SessionByNotificationIdTable.NAME)
onCreate(this)
}
}

Expand Down

0 comments on commit 76418f8

Please sign in to comment.