mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Add ability to pass persistent store options as parameter #12
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sidlatau on GitHub (Sep 28, 2015).
I was unable to enable automatic migrations without modifying CoreStore code (to enable NSMigratePersistentStoresAutomaticallyOption and NSInferMappingModelAutomaticallyOption flags).
I added additional parameter to addSQLiteStoreAndWait method for passing options.
Is there a better way to enable automatic migrations without this modification?
@JohnEstropia commented on GitHub (Sep 28, 2015):
@sidlatau Thanks for the feedback!
The
DataStackalready sets["journal_mode": "WAL"]for you! If you search the code for "journal_mode": "WAL" you'll see that it's being set insideaddSQLiteStoreAndWait(...).As for
NSMigratePersistentStoresAutomaticallyOption, andNSInferMappingModelAutomaticallyOption, CoreStore is smart enough to do the same migration introspection without setting these flags. But, CoreStore does not allow migrations when you useaddSQLiteStoreAndWait(...)because this is a blocking method and migrations may take time. To support migrations, you have to use the asynchronous methods of the formaddSQLiteStore(... completion:)instead.It will help you a lot if you read the README on migrations for more details. Feel free to ask any other questions!