Replace auto migration

Room does a foreign key check and it was causing crashes on someones
device
pull/3491/head
Alex Baker 8 months ago
parent c4cb9e7d6a
commit 44249ff1c9

@ -592,6 +592,14 @@ object Migrations {
} }
} }
private val MIGRATION_89_90 = object : Migration(89, 90) {
override fun migrate(connection: SQLiteConnection) {
connection.execSQL("CREATE INDEX IF NOT EXISTS `index_caldav_tasks_cd_remote_id` ON `caldav_tasks` (`cd_remote_id`)")
connection.execSQL("CREATE INDEX IF NOT EXISTS `index_caldav_tasks_cd_calendar_cd_remote_id` ON `caldav_tasks` (`cd_calendar`, `cd_remote_id`)")
connection.execSQL("CREATE INDEX IF NOT EXISTS `index_caldav_tasks_cd_calendar_cd_remote_parent` ON `caldav_tasks` (`cd_calendar`, `cd_remote_parent`)")
}
}
private fun migration_87_88(context: Context) = object : Migration(87, 88) { private fun migration_87_88(context: Context) = object : Migration(87, 88) {
override fun migrate(connection: SQLiteConnection) { override fun migrate(connection: SQLiteConnection) {
val prefs = Preferences(context) val prefs = Preferences(context)
@ -675,6 +683,7 @@ object Migrations {
MIGRATION_85_86, MIGRATION_85_86,
MIGRATION_86_87, MIGRATION_86_87,
migration_87_88(context), migration_87_88(context),
MIGRATION_89_90,
) )
private fun noop(from: Int, to: Int): Migration = object : Migration(from, to) { private fun noop(from: Int, to: Int): Migration = object : Migration(from, to) {

@ -61,7 +61,6 @@ import org.tasks.data.entity.UserActivity
autoMigrations = [ autoMigrations = [
AutoMigration(from = 83, to = 84, spec = AutoMigrate83to84::class), AutoMigration(from = 83, to = 84, spec = AutoMigrate83to84::class),
AutoMigration(from = 88, to = 89, spec = AutoMigrate88to89::class), AutoMigration(from = 88, to = 89, spec = AutoMigrate88to89::class),
AutoMigration(from = 89, to = 90),
], ],
version = 90 version = 90
) )

Loading…
Cancel
Save