ios - Core data - mixed lightweight and custom migration

So I have version 1 of my Core Data app in the App Store and now I started working on version 2.

I have some small changes to my data base model, and some custom code I need to run after those changes to complete the upgrade from version 1 to version 2.

I can use Core Data's lightweight migration to deal with the model change, and I can run my custom code after the migration is done.

The problem is, i'm not sure what will happen in the future, when I'll build version 3,4,5...

suppose this is the case:
version 1 to version 2 - use lightweight migration
version 2 to version 3 - use custom migration with model mapping
version 3 to version 4 - use lightweight migration again
and so on..

I'm not sure how to build a mechanism that deal with this mix of lightweight and custom migrations.
I couldn't find any code online or in Core Data docs that talk about this issue, I mean this is a very common issue for most of the Core Data apps out there, is there any best practice examples for this issue?

This question and all comments follow the "Attribution Required."

All Answers

Answers Loading...
Leave a Reply
You must be logged in to post a answer.
About the author