vendredi 13 février 2015

SQLite database migration to Core Data with updating live version on App Store

I have live application on the app store. It uses SQLite data storage and ugly methods that save and get data form it. I have replaced the data model with core data. So right now I have one table that contains favorites list. I suppose user will lose their favorites data, and the second problem will be that previous SQLite data base will be in the app.


What's the best way to migrate that data to new data base. So code was ugly, I have started to write new project. It means that there will not be any SQLite data base as before with the same name, just new Core Data db. How usually we need to solve this problem.


I think I can add a method in app delegate that will check if data base with name in the application I will try to retrieve all data from that storage and convert it to the Core Data entities. Then when data will be converted with success, I will drop that database. When I will if all my active users will have this update. I will remove this feature from app delegate because all will up to date. Does it make sense?


Aucun commentaire:

Enregistrer un commentaire