Android Question How to modify SQLite database structure correctly?

Discussion in 'Android Questions' started by ducphu, Mar 10, 2015.

  1. ducphu

    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.
     
  2. Mahares

    Mahares Well Known Member Licensed User

  3. ducphu

    ducphu Active Member Licensed User

    Thank you very much, nice code.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice