Android Question How to modify SQLite database structure correctly?

ducphu

Active Member
Licensed User
Hi All,

When I first release my app, the app has a SQLite database with a table ("Table1") which has 5 columns
As I plan to upgrade my app to next version, I need to expand my databse, i.e add a fews more columns named "Col6", "Col7"... to it. My question is, how to do it correctly?
I'm thinking of counting the number of columns in the existing database,if it is 5 then I start to add columns to it. If it is more than 5, meaned the database already updated.
Or, can I check by column name to see if "Col6","Col7" exist. If not then I do the update. Is such statement available in SQLite?

Anyone has better solution? Thank you.
 
Top