Changed code and released. Now app is timing-out at launch while updating persistent store coordinator to new model. Want to know if the migration is transactional so I can work out what to do to fix. Migration would have got x% through migration before timing out.
If transactional I just need to launch app first and then migrate. If not transactional I’m concerned users will have a schema that is only partially migrated.
Background
Code used to call
persistentStoreCoordinator_ = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
It fails when newer model of database exists, as expected. Previously user would be prompted to update database via a UIAlertView. Then the following statement would be called.
[persistentStoreCoordinator_ addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:optionsDictionary error:&error]
I decided to run the second line of code if initWithManagedObjectModel failed. Not so stupid except this statement is run within the `- (NSPersistentStoreCoordinator *)persistentStoreCoordinator ‘ method so the app now times-out when launching, sometimes.
At this stage I don’t know what to do. Will the database be half-mapped to the new model or will it still represent the previous model?
Core Data migration is transactional in the respect that migration is done in memory and the old database is replaced with the new version, in memory, once completed.
So the time-out problem I was having trying to migrate while launching was resolved when the migration process was removed from the
didFinishLaunchingWithOptionsmethod. The new update fixed the problem for those who had timed-out with the previous upgrade.