1

So I got a sqlite database (version 7) which stores data for my App (version 1.0) and I want to fix a few bugs (that have nothing to do with my database). What happens if I update my App to version 1.1? will the data be deleted? or will it just be deleted if i update the databse version to 8?

(My onUpgrade in the databasehandler will delete the existing databse and create a new one by the way)

2 Answers 2

2

Upgrading an app does not do anything to the database. Old data files are kept intact.

Changing the version number in code for your SQLiteOpenHelper will cause onUpgrade() to be called if the version number in the database file is lower. That by itself doesn't delete anything, but if you yourself delete the data (as you say), then it is lost.

See also: When is SQLiteOpenHelper onCreate() / onUpgrade() run?

Sign up to request clarification or add additional context in comments.

Comments

0

Data will delete if you change the version, but in onUpgrade method we have two parameters

called oldVersion and newVersion. we can do what ever we want by checking old new version

condition.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.