Qt World Summit: Register Today!

Upgrade app without restarting the sqlite database

  • Hi,

    i am working in an App that uses a sqlite database, the database is deployed as a DEPLOYMENTFOLDER in the .pro file:

    @folder_01.source = qml/MyApp
    folder_01.target = qml
    unix: {
    folder_02.source = data/myapp.sql
    win32: {
    folder_02.source = data/*.sql
    DEPLOYMENTFOLDERS = folder_01 folder_02@

    But this causes the database reset if a new reléase of my App is available on the store, how can i solve this? Is there any other way of using databases? I have seen in Android if you overrides SQLiteHelper you can define the operations in the database when installing for first time and when upgrading the application.


  • Would it be practical to, rather than ship a database file that has been prepared in advance, just have the app create the database file itself? If so, that's probably the easiest approach and has the advantage that if someone accidentally deletes the database file after installation your app can just regenerate it. Another option would be to put the database file in a resource and have your program copy that to the appropriate place only if there isn't already something there, but that approach is much less flexible and I wouldn't normally recommend it.

Log in to reply