android - Is it possible to make changes in the existing column in a table for sqlite db -


i have created 1 application live in play store has 3 tables in add 2 more columns table , delete column table.if , update playstore cause effect existing users db or want uninstall app these new changes? if there method can used update tables without affecting user's data.

you should use onupgrade

called when database needs upgraded. implementation should use method drop tables, add tables, or else needs upgrade new schema version.

example

@override     public void onupgrade(sqlitedatabase db, int oldversion, int newversion) {         if (oldversion < 3) {               db.execsql("alter table " + table_name  + " add column mobile_no integer;");               db.execsql("alter table " + table_name  + " add column phone_no integer;");         }      } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -