Questions tagged [mapping-model]

A mapping model is a Core Data construct that helps define how one version of a object model is migrated to another version the object model.

A mapping model is a collection of objects that specifies the transformations that are required to migrate part of a store from one version of your model to another (for example, that one entity is renamed, an attribute is added to another, and a third split into two). You typically create a mapping model in Xcode. Much as the managed object model editor allows you to graphically create the model, the mapping model editor allows you to customize the mappings between the source and destination entities and properties.

from Core Data Model Versioning and Data Migration Programming Guide

67 questions
2
votes
1 answer

Changing the core data model versionIdentifier

I'm trying to debug an issue with my mapping model not being used by my migration, and so I printed out the sourceModel and destinationModel's versionIdentifiers, but both were blank.…
2
votes
2 answers

Fastest way to get a reference to the NSMigrationManager in an automatic migration?

I have a data-heavy app and I have implemented all my CoreData migration stuff using the visual mapping models in XCode and NSEntityMigrationPolicy implementations for the cleanup code. As it turns out, the migrations on a real device are really…
glenc
  • 3,132
  • 2
  • 26
  • 42
2
votes
1 answer

When would I want to use NSPropertyMapping?

Does it have to do with mapping between different data models? To which other Core Data classes is this related? It doesn't look too obvious to me where this belongs to. Merging data models? Or is that just a stand-alone thing? When would I use…
openfrog
  • 40,201
  • 65
  • 225
  • 373
2
votes
4 answers

Problem with core data migration mapping model

I have an iphone app that uses Core Data to do storage. I have successfully deployed it, and now I'm working on the second version. I've run into a problem with the data model that will require a few very simple data transformations at the time that…
dpratt
  • 364
  • 3
  • 11
2
votes
2 answers

Apparently random crashes when migrating a Core Data store

I'm attempting to migrate a Core Data SQLite store in my Mac OS X Leopard app. The migration itself is simple, there's just a couple of changes between the model versions, and there's one custom NSEntityMigrationPolicy that does a little bit of…
iKenndac
  • 18,730
  • 3
  • 35
  • 51
2
votes
1 answer

Validation Errors with Core Data Migration

I'm encountering a very annoying error using Core Data on Mac OS X 10.5. All entities have classes in my application which share the same names. Up to this point, I've done 5 migrations without problems. I'm using the XML data store. I've got V5 of…
1
vote
1 answer

Entity Framework - GetObjectByKey don't allow the primary key

I'm trying to get a record using GetObjectByKey function like this: Enumerable> entityKeyValues = new KeyValuePair[] { new KeyValuePair("JournalId", …
brittongr
  • 329
  • 1
  • 11
1
vote
1 answer

CoreData lightweight migration crashes, even after adding a mapping model

In my CoreData model I created an abstract entity (IDManagedObject) to share a common attribute for my other entities. When I first ran it I got several Cannot merge multiple root entity source tables into one destination entity root table…
koen
  • 5,383
  • 7
  • 50
  • 89
1
vote
1 answer

Database Design : Should we add timestamp columns for mapping tables also?

Usually it convention not update records of mapping tables rather delete same and add new. In that case it is not relevant to add updated_on column in mapping tables but still some one can update the table by mistake or intentionally which suggest…
Maddy.Shik
  • 6,609
  • 18
  • 69
  • 98
1
vote
2 answers

Update crashes after coredata automatic lightweight migration

I recently submitted an upgrade of my app which included a lightweight coredata migration (including new fields in existing tables and a couple of new tables). I followed every tip regarding this migration, including some I found on this site. I…
Mariano
  • 11
  • 2
1
vote
2 answers

Migrating from a single entity to an abstract parent entity with child entities, NSEntityMigrationPolicy not called

I'm trying to upgrade my current application to use an abstract parent entity, with specialized sub entities. I've created a custom NSEntityMigrationPolicy, and in the mapping model I've set the Custom Policy to the name of my class. I'm…
1
vote
1 answer

Preventing Core Data Errors

I have created a Mac application for the app store - and now find it necessary to modify my 'model' file for Core Data. In my experience, changing this model creates an error upon opening an old file (document based app) that is tied to the old…
Zakman411
  • 1,764
  • 3
  • 22
  • 45
1
vote
1 answer

iphone - Adding new entity to core data model?

Is adding a new entity on the new version of my core data model going to crash the apps using the older versions of core data model? What if this entity has a relationship with an existing entity. oldEntity (1)------------->(oo) newEntity
aryaxt
  • 76,198
  • 92
  • 293
  • 442
1
vote
1 answer

Updating multiple models during end stage of NSEntityMigrationPolicy

I'm writing my first NSEntityMigrationPolicy right now and this one is pretty simple. It fetches a singleton from the DB and then churns through records of three other types and links them to the singleton for a new relationship that's been added…
glenc
  • 3,132
  • 2
  • 26
  • 42
1
vote
1 answer

CoreData can't find mapping model in an OSX framework bundle, but works fine in iOS

I have CoreData-based data layer (using a SQLite datastore) that I am using in both an iOS app and on the server that the iOS clients talk to. The data layer (objc code + coredata model / mapping defns) is compiled into the iOS bundle as per usual,…
glenc
  • 3,132
  • 2
  • 26
  • 42