Android : Upgrading user database using SQLiteAssetHelper -
i cant seem understand how upgrade database after reading docs @ https://github.com/jgilfelt/android-sqlite-asset-helper
i want keep users data in 1 table only. don't need alter tables. upgrade pretty adding new rows in table.
so flow (i'm guessing) :
onupgrade :
1) arraylist of user defined data table 1
2) update database
3) put user data table 1
am thinking wrong?
tips appreciated.
i misunderstood point of update script.
when app updated not install new database. keeps old 1 , runs update script bring old 1 speed.
so if dont need change user data not lost. run sql in script.
if need alter user data table can use temporary table change.
eg :
-- add fullnames column employees alter table "employees" rename 'employees_me_tmp'; create table "employees" ( "employeeid" int not null, "lastname" varchar(20) not null, "firstname" varchar(10) not null, "fullname" varchar(150), primary key ("employeeid") ); insert "employees" ( "employeeid", "lastname", "firstname", "fullname" ) select "employeeid", "lastname", "firstname", "firstname" || ' ' || "lastname" "employees_me_tmp"; drop table "employees_me_tmp";
Comments
Post a Comment