Fixed a bug where the 'migrationNoLongerSupported' would be thrown for new accounts

This commit is contained in:
Morgan Pretty 2023-08-30 14:11:12 +10:00
parent a4ade7fdb4
commit 3e4a2013d3
3 changed files with 13 additions and 3 deletions

View File

@ -13,7 +13,11 @@ enum _003_YDBToGRDBMigration: Migration {
static let minExpectedRunDuration: TimeInterval = 0.1
static func migrate(_ db: Database) throws {
guard !SNUtilitiesKit.isRunningTests else { return Storage.update(progress: 1, for: self, in: target) }
guard
!SNUtilitiesKit.isRunningTests &&
Identity.userExists(db)
else { return Storage.update(progress: 1, for: self, in: target) }
SNLogNotTests("[Migration Error] Attempted to perform legacy migation")
throw StorageError.migrationNoLongerSupported
}

View File

@ -11,7 +11,10 @@ enum _003_YDBToGRDBMigration: Migration {
static let minExpectedRunDuration: TimeInterval = 0.1
static func migrate(_ db: Database) throws {
guard !SNUtilitiesKit.isRunningTests else { return Storage.update(progress: 1, for: self, in: target) }
guard
!SNUtilitiesKit.isRunningTests &&
Identity.userExists(db)
else { return Storage.update(progress: 1, for: self, in: target) }
SNLogNotTests("[Migration Error] Attempted to perform legacy migation")
throw StorageError.migrationNoLongerSupported

View File

@ -10,7 +10,10 @@ enum _003_YDBToGRDBMigration: Migration {
static let minExpectedRunDuration: TimeInterval = 0.1
static func migrate(_ db: Database) throws {
guard !SNUtilitiesKit.isRunningTests else { return Storage.update(progress: 1, for: self, in: target) }
guard
!SNUtilitiesKit.isRunningTests &&
Identity.userExists(db)
else { return Storage.update(progress: 1, for: self, in: target) }
SNLogNotTests("[Migration Error] Attempted to perform legacy migation")
throw StorageError.migrationNoLongerSupported