I found that when upgrading a table which has a relationship defined as "to One", to one that this relationship has changed to "to Many" the migration code fails.
It appears that the migration code within EncryptedStore.m expects this relationship to remain constant. (Within alterTableForSourceEntity:destinationEntity:withMapping:error:)
Otherwise alterTableForSourceEntity: attempts to create Columns for these relationships and fails. This appears to be a bug.
We have been able to fix this bug locally by changing:
if (![relationship isToMany]) to:
if (!([relationship isToMany] || [destinationRelationship isToMany]) ) within the section: // add in fields for relationships,
and
if ([destinationRelationships objectForKey:key]) to:
if ([destinationRelationships objectForKey:key] && ![[destinationRelationships objectForKey:key] isToMany]) within the [sourceRelationships enumerateKeysAndObjectsUsingBlock:^...] section.
I found that when upgrading a table which has a relationship defined as "to One", to one that this relationship has changed to "to Many" the migration code fails.
It appears that the migration code within EncryptedStore.m expects this relationship to remain constant. (Within alterTableForSourceEntity:destinationEntity:withMapping:error:)
Otherwise alterTableForSourceEntity: attempts to create Columns for these relationships and fails. This appears to be a bug.
We have been able to fix this bug locally by changing: if (![relationship isToMany]) to: if (!([relationship isToMany] || [destinationRelationship isToMany]) ) within the section: // add in fields for relationships, and if ([destinationRelationships objectForKey:key]) to: if ([destinationRelationships objectForKey:key] && ![[destinationRelationships objectForKey:key] isToMany]) within the [sourceRelationships enumerateKeysAndObjectsUsingBlock:^...] section.