Introduction to Migration in Apple's Core Data
- Why Do I Need to Care About Core Data Migration?
- What Does It Do?
- How Does It Work?
- Managed Object Model Bundles
- Mapping Model
- Adjusting Your Code
- Triggering a Version Change
Core Data was introduced with OS X 10.4 Tiger. In a nutshell, Core Data is an object graph for data storage that can be used like a database and contains its own persistence engine.
With this framework, developers could avoid having to deal with writing their own storage formats and all the troubles that come along with it. This also greatly reduced the amount of code that a developer needed to write since the entire object graph was contained within Core Data.
Why Do I Need to Care About Core Data Migration?
However, there was one area that Core Data was sorely lacking. Most of the persistent formats that Core Data supported locked the data to that format. What this means is that if you changed your data’s structure from one version to the next the older data could no longer be read in by the newer version of your application.
Worse still, when you looked to the Core Data framework for help with this issue, the only answer was to do the migration yourself. Fortunately, it has all changed with OS X 10.5 Leopard.