Set auto migration to false (#675)

This commit is contained in:
Mingshen Sun 2025-02-07 18:15:39 -08:00 committed by GitHub
parent a69c4d16b1
commit a43f2b017c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,11 +20,11 @@ public class PersistenceController {
init(isUnitTest: Bool = false) {
self.container = NSPersistentContainer(name: Self.modelName, managedObjectModel: .sharedModel)
let description = container.persistentStoreDescriptions.first
description?.shouldMigrateStoreAutomatically = false
description?.shouldInferMappingModelAutomatically = false
if isUnitTest {
let description = NSPersistentStoreDescription()
description.url = URL(fileURLWithPath: "/dev/null")
container.persistentStoreDescriptions = [description]
description?.url = URL(fileURLWithPath: "/dev/null")
}
}