Database Reference
In-Depth Information
Tap the plus (+) button in the top-right corner to add a new note. Add a title (there
is default text in the note body to make the process faster) and tap
Create
to save
the new note to the data store. Repeat this a few times so that you have some
sample data to migrate.
Back in Xcode, open the
UnCloudNotesDatamodel.xcdatamodeld
file to show
the entity modeling tool in Xcode. The data model is simple—just one entity, a
Note
, with a few attributes.
You're going to add a new feature to the app: the ability to attach a photo to a
note. The data model doesn't have any place to persist this kind of information, so
you'll need to add a place in the data model to hold onto the photo. But you already
added a few test notes in the app—how can you change the model without breaking
the existing notes? It's time for your first migration!
A lightweight migration
With the entity modeler open, open the
Editor
menu and select
Add Model
Version...
. Call the new version
UnCloudNotesDataModel v2
and select