Chapter 6: Migrating non-sequential versions

I got some data corruption errors when trying this chapter.
SQLLite databases have the default option to use journaling.

I fixed this in the CoreDataStack by setting the journal_mode to DELETE:

 lazy var storeDescription: NSPersistentStoreDescription = {
        let description = NSPersistentStoreDescription(url: self.storeURL)
        description.setValue("DELETE" as NSObject, forPragmaNamed: "journal_mode")
        description.shouldMigrateStoreAutomatically = true
        description.shouldInferMappingModelAutomatically = false
        
        return description
    }()

thanks for sharing! I’ll pass this along to the authors, @pietrorea @astralbodies

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.