问题
I am developing a Windows Store App that uses SQLite for Windows Runtime Extension and sqlite-net library to store data in a local SQLite database. This database is created in Windows.Storage.ApplicationData.Current.LocalFolder.Path
path.
Everything works like it should and I guess I will not have problems when submiting.
Question 1
But what will happen when I change the app, submit again and the user updates it? Will database file be deleted? Will the user lost his data?
Question 2
Will I be able to use the old database and upgrade it between app versions?
I know how to do it when developing Android apps but this Windows Store Update process is new to me and I am afraid of doing some mistake that makes me unable to recover users data. If someone has already gone through it tell me how it works please.
Thanks in advance
回答1:
Application data persists over updates; it would only be deleted if the user uninstalled the application. From Accessing app data with the Windows Runtime:
The system manages the data stores for an app, ensuring that they are kept isolated from other apps and other users. The system also preserves the contents of these data stores when the user installs an update to your app and removes the contents of these data stores completely and cleanly when your app is uninstalled.
Given that, you certainly would have access to the current (old) version of their local database, so it would be up to you to build in any migration/upgrade functionality as part of the app.
来源:https://stackoverflow.com/questions/15703352/upgrading-database-on-app-update