private static final String TABLE_MAIN_CREATE = \"CREATE TABLE IF NOT EXISTS \" + TABLE_MAIN_NAME + \" ( a INTEGER, b LONG, c TEXT, d TEXT, e DATETIME, f TEXT)\";
pr
One way you can do inside onUpgrade
method is to drop the table and recreate it. This way, only the data for that particular table will be deleted and not the whole DB data.
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
Log.w("TAG", "Upgrading database from version " + oldVersion + " to " + newVersion);
switch (oldVersion)
{
case 1:
db.execSQL("DROP TABLE IF EXISTS " + TABLE_MAIN_NAME);
db.execSQL(TABLE_MAIN_CREATE);
default:
break;
}
}