mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Custom Migration #116
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tosbaha on GitHub (Jan 6, 2017).
Hi,
I am in the process of upgrading my stack I need to do some migration. Lightweight migration works but leaves a property that I don't need it any more. I am sorry if this issue is not relevant. I checked the documentation but I only saw reference to lightweight migration. How can I do following migration with CoreStore?
Old Model
New Model
I did the renaming by using Data Model inspector and using
idas Renaming IDMy Current code with my old CoreData stack is like below which does the migration but leaves company attribute in new model.
@JohnEstropia commented on GitHub (Jan 6, 2017):
@tosbaha The setup code for lightweight and custom migrations in CoreStore is the same. See
https://github.com/JohnEstropia/CoreStore#progressive-migrations
where you have to provide a
MigrationChainto theDataStack.For custom migrations, CoreStore will look for a .xcmappingmodel file in your bundle for the source and destination model versions. If CoreStore finds one it will use that mapping, if it doesn't find one it will try to use lightweight migration as a last resort.
@tosbaha commented on GitHub (Jan 6, 2017):
Thanks for quick reply. I did following but it seems it is crashing. Could you tell me why ?
I get
I also tried FUNCTION($entityPolicy, "valueForcompany:" , $source.company) again I get
I am using Swift 3. Is there a breaking change?
EDIT: If I change function to
Then it worked. 🤷♂️
@JohnEstropia commented on GitHub (Jan 7, 2017):
Glad it worked for you :) I'm closing this issue now but if you have other questions feel free to ask!