Reputation: 280
please explain me next information. I have app with CoreDataModel1, and now I create CoreDataModel2. And I need to use CoreDataModel2 in my app. I read about migration and ti's work fine. But I don't need the previous data from CoreDataModel1. How I should do this. When I make migration all my previous data copy to CoreDataModel2 but I don't need it.
Upvotes: 0
Views: 103
Reputation: 80271
The way I understand your problem, you do not care about the old database file or data. In this case, you might just create a new model with a new persistent store url (i.e. file name) and ignore the old one.
The standard way is to simply select the second model version as the current one, switch on
NSMigratePersistentStoresAutomaticallyOption
and
NSInferMappingModelAutomaticallyOption
,
and if need be delete old data upon startup.
Upvotes: 0
Reputation: 70976
Normal Core Data migration doesn't need this, because there is no copy. The migration process updates the persistent store file to use the new model, keeping the same file. There's no old file to delete.
If you have implemented a custom migration scheme that does copy the data to a new file, then you're on your own. You remove whatever old file(s) your scheme leaves behind that you don't need any more.
Upvotes: 1