Automatic Lightweight Migration
Intermediate Training Core Data
Migrations are a necessary part of Core Data development that helps maintain data consistency and compatibility across different versions of your app. When your models have not changed drastically, you can typically get away with a simple and straightforward Lightweight Migration. In this lesson, we'll go through how to add a different model version for Core Data and also applying the lightweight migration.

Comments (6)
mcordero
5 years ago
I tried making the change 3x and I keep getting this error: 2017-11-22 20:02:12.713888-0600 IntermediateTraining[39797:4881036] [logging] table ZEMPLOYEE already exists 2017-11-22 20:02:12.714365-0600 IntermediateTraining[39797:4881036] [error] error: (1) I/O error for database at / SQLite error code:1, 'table ZEMPLOYEE already exists'
tinypixelpdx
5 years ago
I had the same issue. I started fresh again from episode 29, created the new model v.1, changed name to fullName, updated the RenamingID to 'name', and changed the 3 occurrences in the code from name to fullName. Each time the Xcode would crash and I would get the same errors above. I cleaned the derived data and the cleaned the build folder but still nothing. The only way I was able to get it to work was when the Simulator was up, go into the Hardware menu, then select Erase All Content and Settings. Let me know if that works for you.
sekjn0
5 years ago
I got this problem when adding the Renaming ID while the Employee entity where selected. You must have the fullName attribute selected when adding the Renaming ID.
jeffkral
5 years ago
Erase All Content and Settings worked for me. Thanks!
jpickard
5 years ago
"Erase All Content and Setting" on the Simulator.
jch-duran
5 years ago
This was so cool. Thank you for sharing this. This is my first time performing a lightweight migration.
dclawson
5 years ago
This might not happen to anyone else, but I noticed that XCode didn't present me with the right drop-down contents for the "Editor" menu the first time. I clicked into the panel that has the "ENTITIES" items, and then saw that the correct menu items appeared.
chasekling
4 years ago
This may help someone else. When I made my v1.1 model, my app kept crashing with an error along the lines of "table ZEMPLOYEE already exists coredata." If your app keeps crashing, I recommend deleting and then building your xcode project again. https://stackoverflow.com/questions/9897452/core-data-migration-table-already-exists Bryan, have you run into this on other projects?
Brian Voong
4 years ago
Cinquain
4 years ago
More fire!
Cinquain
4 years ago
Light migrations are lightweight
HELP & SUPPORT