Skip to content

Commit

Permalink
Enable automatic migtation in CoreDataStack
Browse files Browse the repository at this point in the history
  • Loading branch information
mohannad-hassan committed Jan 28, 2025
1 parent 22945c2 commit fec2125
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Data/CoreDataPersistence/Sources/CoreDataStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public class CoreDataStack {
description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)

// Enables automatic data migration.
description.shouldMigrateStoreAutomatically = true
description.shouldInferMappingModelAutomatically = true

container.loadPersistentStores(completionHandler: { _, error in
guard let error = error as NSError? else { return }
fatalError("###\(#function): Failed to load persistent store: \(error)")
Expand Down

0 comments on commit fec2125

Please sign in to comment.