From fdea2b47da8a17dc0a176e207acae84dcc365f11 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Thu, 17 Aug 2023 17:10:41 +0300 Subject: [PATCH] Fix sources migration --- .../koitharu/kotatsu/core/db/migrations/Migration16To17.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration16To17.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration16To17.kt index cc86586f8..39bb68184 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration16To17.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration16To17.kt @@ -21,13 +21,15 @@ class Migration16To17(context: Context) : Migration(16, 17) { continue } val name = source.name + var isEnabled = name !in hiddenSources var sortKey = order.indexOf(name) if (sortKey == -1) { sortKey = order.size + source.ordinal + isEnabled = false } database.execSQL( "INSERT INTO `sources` (`source`, `enabled`, `sort_key`) VALUES (?, ?, ?)", - arrayOf(name, (name !in hiddenSources).toInt(), sortKey), + arrayOf(name, isEnabled.toInt(), sortKey), ) } }