karan
karan

Reputation: 335

Core data model migration

I want migrate the core data two models. According to apple documents there are two ways to migrate the model like light weight migration and mapping model. My confusion is In which scenario i need to use mapping model way of core data migration.

Upvotes: 0

Views: 366

Answers (1)

Maciej Oczko
Maciej Oczko

Reputation: 1225

Lightweight migration is performed when you add/modify/delete attribute or entity - generally simple operations.

Mapping option is needed when you have to transform one schema into another. Let's say you and entity A, but you need to divide it into two: B and C. Then you have to tell CoreData how to map entities and attributes between the schemes.

This process is a little bit more complicated than lightweight migration. It requires to create mapping model file, define NSEntityMigrationPolicy subclass if needed, and so on, depending on your needs.

Upvotes: 1

Related Questions