Don't want to replace the old database when app is updated

后端 未结 3 1716
面向向阳花
面向向阳花 2021-01-03 13:21

In my app I am using sqlite database I don\'t want to replace an existing database when app is updated in app store.

Will it replace with new database? Or will it re

3条回答
  •  离开以前
    2021-01-03 13:46

    @Ankit: Hi..

    Answer is NO it will not replace the database it will remain the same old database for the users who are aready using previous version of your app and then they just download and install the new version of the app without deleting the previous version.

    It will replace database on App Store but it does not replace the database by default if the user is using previous version of your app. If database already exists then it does not replace the database procedure

    We have to make a database upgrade procedure where in we have to check some flag or the version number in database if provided and based on that we have to create a database upgrade procedure.

    You have to make the changes in database using database upgrade procedure and make alterations into existing tables such as adding or deleting a column or may be changing the structure of the table using SQL Queries.

    Then you have to finally update the version number or some flag in the database which would let it know that the database is already upgraded so it should not run the same procedure every time when application loads.

    Also it is important that you take care of the existing data that the user has stored in his/her database. It should not be deleted.

    Feel free to contact me if you need more help.

    Hope this helps.

提交回复
热议问题