I know that the Document directory remains when app updates in iOS. But what about the database .sqlite file. how to get the old user data from old database having old data model to new updated data model database or how new database from bundle replaces old database without deleting user’s old data.
Share
In case of CoreData, there is Apple’s convenient lightweight migration. You just have to create a new version of your data model, and during the update Apple will just transform your old store into a new one. Here are the docs.
In case of sqlite3, you have to roll your own. Have a new populated sqlite database in your bundle, copy it to the documents directory and then import each record with the user data from the old database into the new one, making the changes as necessary.