fix(migration): Add Merged Manga Dedupe Mode Migration and update versioning (#1258)

This commit is contained in:
Cuong-Tran 2025-10-30 08:59:30 +07:00 committed by GitHub
parent dd69b6f9c0
commit f668e31cf6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 38 additions and 2 deletions

View file

@ -25,8 +25,8 @@ android {
defaultConfig {
applicationId = "app.komikku"
versionCode = 76
versionName = "1.13.4"
versionCode = 77
versionName = "1.13.5"
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")

View file

@ -0,0 +1,35 @@
package mihon.core.migration.migrations
import mihon.core.migration.Migration
import mihon.core.migration.MigrationContext
import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.data.DatabaseHandler
import tachiyomi.data.manga.MergedMangaMapper
import tachiyomi.domain.manga.interactor.UpdateMergedSettings
import tachiyomi.domain.manga.model.MergeMangaSettingsUpdate
class MergedMangaDedupeModeMigration : Migration {
override val version: Float = 77f
override suspend fun invoke(migrationContext: MigrationContext): Boolean = withIOContext {
val handler = migrationContext.get<DatabaseHandler>() ?: return@withIOContext false
val updateMergedSettings = migrationContext.get<UpdateMergedSettings>() ?: return@withIOContext false
// Get merged manga references from db
val dbMergedMangaReferences = handler.awaitList {
mergedQueries.selectAll(MergedMangaMapper::map)
}
dbMergedMangaReferences.map {
MergeMangaSettingsUpdate(
id = it.id,
chapterSortMode = (it.chapterSortMode - 1).coerceAtLeast(0),
isInfoManga = null,
getChapterUpdates = null,
chapterPriority = null,
downloadChapters = null,
)
}.let { updateMergedSettings.awaitAll(it) }
return@withIOContext true
}
}

View file

@ -48,6 +48,7 @@ val migrations: List<Migration>
IntegratedHentaiMigration(),
SetupAppUpdateMigration(),
EHentaiMigration(),
MergedMangaDedupeModeMigration(),
// KMK <--
TrustExtensionRepositoryMigration(),
CategoryPreferencesCleanupMigration(),