Is it possible to do a lightweight migration which uses data imported from another app? My situation is that iOS 11 has badly broken one on the my apps. Rather than try to fix it, I’ve decided it would be much better to re-write everything and release a new app, version 2. Some customers are asking me if they will be able to carry on using the database they have built up with version 1 of the app. Version 2 uses a similar database with some minor changes, the kind which would normally be fine for lightweight migration. The two databases use a different name.
Is it possible for me to allow users to import their version 1 database via iTunes, and have the app update it to version 2 using lightweight migration?
If I understand you correctly, you would like to issue a newer version of your app, which would allow users to migrate their data from version 1 over to the new and improved version? The answer is yes, this is precisely what Core Data migration is for.
What you need to remember is that migration refers to moving data from one data model structure, to another. As long as you can smoothly move the data over without causing any crashes, you should be fine. The key is to make sure that your objects map correctly, and that the attributes are of the same type. Once you’ve done adequate testing to ensure that the transition is safe, and robust, you simply need to upload your newest version of your app to the app store with your mapping models. As the user updates the app on their device to your new version, the data currently on their app should migrate over to your new data model in your new version. The name of the data model shouldn’t matter, so long as you specify the correct data model you are migrating to inside your mapping files.
Thanks. That’s not exactly what I was meaning. I’ve already done app updates with lightweight migrations as you describe. What I’m asking about here is releasing a completely new version of the app, allowing the user to do a “manual” lightweight migration by copying the database from the old app into the new one. So it’s a separate app that’s based on the other one, with a similar database structure, but a new app nonetheless, not just an incremental update.