简体   繁体   中英

Core data versioning/migration after deleting entities

I have a database which consists of 3 entities, say 'IronMan', 'CaptainAmerica' and 'SpiderMan' . With new changes, I want to delete all three entities and create another entity called 'Thanos'.

I would not need to use any of the code and data stored earlier with entities 'IronMan', 'CaptainAmerica' and 'SpiderMan' . Do I need to do core data versioning or migration in this case?

As mentioned in Apple's documentation

https://developer.apple.com/documentation/coredata/using_lightweight_migration

You can add, remove, and rename entities in the hierarchy.

So, yes, you need to provide migration (new version model) but can stick to a light-weight migration, hence it will be done automatically based on changes done between the 2 models.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM