My previous post was the second part in a three part series documenting my attempt at using a custom migration from one Core Data model version to another. I implemented custom NSEntityMigrationPolicy code to create the destination entities and to convert the currency values typed as double into values typed as decimal.
This post will show how to initiate default migration using the mapping model and custom migration policy code from the last posting.
Showing posts with label Core Data. Show all posts
Showing posts with label Core Data. Show all posts
Wednesday, September 3, 2014
Monday, September 1, 2014
Core Data Custom Migration, Part 2: Custom Migration Code
In my last post, I wrote about the change I found myself needing to make in order to properly represent currency value information in Core Data using the built-in decimal type as opposed to the double type. I described the process involved in versioning the Core Data model, adding a mapping model from the previous version to the new version, and specifying custom NSEntityMigrationPolicy classes for each entity that needed to be mapped to the new version.
In this post we'll see about implementing the NSEntityMigrationPolicy subclass code for converting existing currency double values into decimal values.
In this post we'll see about implementing the NSEntityMigrationPolicy subclass code for converting existing currency double values into decimal values.
Saturday, August 30, 2014
Core Data Custom Migration, Part 1: Versioning & Setting Migration Policy
The current app I'm working on as a side project is an expense tracking and budgeting app. For this app I am, of course, using Core Data to save all the tracked expenses that a user enters. Since I was modeling expense data, I gave it no additional thought to use a double-precision floating point as the type for the expense amount. It turns out, this isn't exactly such a hot idea.
Subscribe to:
Posts (Atom)