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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -