diff --git a/app/src/main/java/mihon/core/migration/MigrationStrategyFactory.kt b/app/src/main/java/mihon/core/migration/MigrationStrategyFactory.kt index 7e06fecb3d..0905cc086a 100644 --- a/app/src/main/java/mihon/core/migration/MigrationStrategyFactory.kt +++ b/app/src/main/java/mihon/core/migration/MigrationStrategyFactory.kt @@ -6,15 +6,13 @@ class MigrationStrategyFactory( ) { fun create(old: Int, new: Int): MigrationStrategy { - val versions = (old + 1)..new val strategy = when { old == 0 -> InitialMigrationStrategy( strategy = DefaultMigrationStrategy(factory, migrationCompletedListener, Migrator.scope), ) - old >= new -> NoopMigrationStrategy(false) else -> VersionRangeMigrationStrategy( - versions = versions, + versions = (old + 1)..new, strategy = DefaultMigrationStrategy(factory, migrationCompletedListener, Migrator.scope), ) } diff --git a/app/src/main/java/mihon/core/migration/Migrator.kt b/app/src/main/java/mihon/core/migration/Migrator.kt index 11f22a8c9b..2296aa0747 100644 --- a/app/src/main/java/mihon/core/migration/Migrator.kt +++ b/app/src/main/java/mihon/core/migration/Migrator.kt @@ -10,7 +10,7 @@ import kotlinx.coroutines.runBlocking object Migrator { private var result: Deferred? = null - val scope = CoroutineScope(Dispatchers.Main + Job()) + val scope = CoroutineScope(Dispatchers.IO + Job()) fun initialize( old: Int,