Migration away from attributes that have a reserved name (e.g. type) does not work

Number:rdar://20085508 Date Originated:08-Mar-2015 10:43 AM
Status:Open Resolved:No
Product:iOS SDK Product Version:8
Classification:No rank Reproducible:yes
I used to have an entity with an attribute named 'type'. While this works fine, iTunesConnect would give a private API warning on 'primitveType' (an accessor we generate using mogenerator). So we wanted to change that attribute to a different name.

In a new Core Data model version we changed the property name to 'productType'. The migration appeared to work fine, but it actually did not change the name of the underlying column in the sqlite database.

Steps to Reproduce:
(this assumes a default iOS project)

1. create a core data model with entity 'Product' and attribute 'type'
2. run the project
3. create a new model version where you change the attribute's name to 'productType'
4. run the project
5. open the .sqlite database and notice the column is still called type (and not productType)

Expected Results:
It is expected that the migration actually does what it should do and not silently skip some properties that happen to be restricted keywords.

Actual Results:
The migration silently fails

iOS 8.x

The solution should, I think, be two part:
1. the tooling should not allow the creation of attributes with reserved names
2. the migration should not ignore attributes with reserved names

tested on iPhone 6 & iPad Mini 2. Probably all devices are affected



Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!