Reputation: 427
I have an app containing database structure.I need to update the version with new database structure that it contains changes in columns,removal of columns.deletion of columns.Is this really possible for the change in existing database structure.If it is possible means,where i have to do the changes in the app code?
Shall i need to create the new database structure and do the rest in Upgrade event or Do i need to do changes only in upgrade event?
Upvotes: 0
Views: 95
Reputation: 27659
You can do it in SQLiteOpenHelper's onUpgrade() event, like:
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
db.execSQL("DROP TABLE ....");
db.execSQL("ATER TABLE ....");
onCreate(db);
}
Upvotes: 1