I am learning Core Data Migration, and i mistakenly made some changes to my current schema file itself. But, I do have a backup copy of that project, which uses the previous schema. Now, i do not want to start from scratch again, but i do want to use the old schema as a part of migration. So here are the steps I am planning to achieve:
(1) Import the old .xcdatamodel file from the backup project into the main project, and make it v1.xcdatamodel
(2) Rename the .xcdatamodel file in the existing project(main) as v2.xcdatamodel
(3) define the “options” dictionary and set it up for it to be used by the persistentstorecoordinator.
I am not sure whether this will work.
Can anyone suggest me the right solution to the problem ??
Ok. Now i understand the concept. Core data allows you to store multiple .xcdatamodel(ManagedObjectModel) files in your .xcdatamodeld folder, which stores these files. What I did was, i copied the old MOM file and placed it in the .xcdatamodeld folder in my current(new) project. Now, light migration comes into picure, and executes the migration properly.