Ch 6, Saving a copy of the Data store file

Hi all,

I know I’m going to realize the answer as soon as I hit send, but oh well (and maybe not), I will take one for the team.

The text says

“You may also want to save a copy of the data store file and append the name with “v2” for this version of the application as you’ll use this later on for more complex migrations.”

I suppose I missed this, but where exactly is the data store file? Where is this stored on disk?

@casademora @astralbodies Can you please help with this when you get a chance? Thank you - much appreciated! :]

@afinque Thanks very much for your question!

The data store file (to the best of my knowledge) is referring to the data model, the file where you design the architecture of your object graph. This is where you create your entities, their properties, as well as the relationships between them. This data model is built on top of SQLite, and the raw data from your data model is stored in a .sqlite file. This file is stored in a subdirectory of the Library parent directory called, “Application Support”. In this folder, you’ll find the .sqlite, .sqlite-shm file, and .sqlite-wal files for Core Data. My advice for you would be to make a copy of these files for the project you are working on.

Having said that, if you’re doing data migrations, during the process you are able to generate a new data model in Xcode, and in doing so, you’ll be required to provide a new version number. This should suffice, and you shouldn’t have to make any additional copies of your data model, as you are allowed to revert back to older versions if necessary.

I hope this helps :slight_smile:

All the best!

This topic was automatically closed after 166 days. New replies are no longer allowed.