I have what appears to be a bug with Core Data in OS X 10.7.1.
My data store (NSSQLiteStoreType) is not being automatically migrated correctly.
As a side note the exact same Core Data models are used by an iOS version of the app.
-> Here is what appears to be happening.
Up until the latest release everything has been working fine --
I have 14 revisions of the model -- model 13 has been shipping for quite some time without incident.
Recently I updated my app and added a new model so I am at 14 (this is the version now used in the shipping apps).
The iOS version works just fine when migrating from model 13 to 14 -- so no need to worry about that.
So rather then talking about OS X versions lets use NSPersistenceFrameworkVersions
NSPersistenceFrameworkVersions 251 being 10.6.8 and NSPersistenceFrameworkVersions 358 being 10.7.1
If we use like versions -- meaning model 13 version 251 and migrate to model 14 version 251 it works fine.
same is true if we use model 13 version 358 and migrate to model 14 version 358 it also works fine
Here is where it gets interesting
if we migrate model 13 version 358 to model 14 version 251 it still works fine
However migrating from model 13 version 251 to model 14 version 358 does not work
CoreData: error: (1) I/O error for database at blah. SQLite error code:1, 'no such column: FOK_REFLEXIVE'
Again this only happens when going from 10.6.8 (NSPersistenceFrameworkVersions 251) to 10.7.1 (NSPersistenceFrameworkVersions 358) all other permutations work just fine.
Here are the options used for migration that get passed to addPersistentStoreWithType.
// Allow inferred migration from the original version of the application.
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
One final thing, it appears if we only add attributes to model 14 the conversion will not break. It is only with the addition of an entity that will cause it to break.
Anybody else seeing this sort of problem. -thanks in advance.