How to migrate and don't lose data?
SerhiiMatvieiev opened this issue · 2 comments
Hi, I have app in production where I use MagicalRecord and setup it this way:
MagicalRecord.setupCoreDataStack(withStoreNamed: "MyAppName")
Now I want to change something in my DB, how can I do it without losing old data?
I have tried change to this:
MagicalRecord.setupAutoMigratingCoreDataStack()
but it clear all my data
Did you end up figuring out out to do this?
I'm watching this issue for a long time, probably when i tried to migrate a core data version with magicalRecord for first time.
The only solution for me, was using MagicalRecord.setupAutoMigratingCoreDataStack()
and doing a Heavyweight or Lightweight Core data Migration. Creating another version for your Model(.xcdatamodeld) and doing all changes in there(the lightweight way), generally works, but depends on what you'v changed on your db scheme, you may need to create mapping models(.xcmappingmodel) and/or NSEntityMigrationPolicy
s.
No way to despiste that steps. You can found many tutorials of how doing migrations on te web.