Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper way of updating pre-populated database #55

Closed
remisture opened this issue Feb 2, 2017 · 3 comments
Closed

Proper way of updating pre-populated database #55

remisture opened this issue Feb 2, 2017 · 3 comments

Comments

@remisture
Copy link

The pre-populated database file is ignored if the database file with the same name already exists in your database file location.

What is the suggested steps of forcing an app to to get the latest version of a pre-populated database (I have both updated existing rows, and added new ones, but the changes are not reflected unless the app is uninstalled first)?

  1. Rename database to a new unique name
  2. Close connection to old database
  3. Delete old database
  4. Open new database

And repeat these steps (for all versions) every time I make changes?

Is there a guide covering this use case somewhere?

@remisture
Copy link
Author

Anyone?

@brodycj
Copy link
Owner

brodycj commented Feb 13, 2017

My apologies for the delay. Assuming the app did not store any user data in the database:

The new version of your app should use a new database with a new name. It should also be smart enough to delete the old database if it exists (or just call sqlitePlugin.deleteDatabase and ignore the success/error callbacks).

Please keep in mind that it is extreemely difficult if not impossible to know how long it will take for users to upgrade their apps. So newer versions of the app should just include the logic to cleanup the old database if it exists.

@remisture
Copy link
Author

Thank you.

I have no user data in the database, so the approach of adding new database and cleaning up old ones should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants