Friday 19 April 2013

Data migration & Core data model versioning

some facts...
  • core data store can be accessed only by object model created it.
  • change in object model makes it incompatible with store created by it previously. 
  • so some way needed to change store format according to change in model,  where migration comes in to scene.
  • for migration, each model assigned its version. so versioned model consists of more then one models with different versions.  
  • we need version of current model and new model where we want to migrate our store.
  • core data uses current version of model and can open persistant stores created by any models and can migrate store according to current version.
  • though some info needed to how to map one mode to another in form of hints in versioned model itself or separate mapping file.