mardi 13 octobre 2015

Create new table after publish application

I have an existing app published and I want to create new table but I'm confuse.

If I create a new table,other data from other tables will deleted ? if yes, how can I do ?

@Override
public void onCreate(SQLiteDatabase db) {
    db.execSQL(CREATE_GROUPS_TABLE);
    db.execSQL(CREATE_A_GROUPS_TABLE);
    db.execSQL(CREATE_MESSAGES_TABLE);
    db.execSQL(CREATE_REPORTING_TABLE);
    db.execSQL(CREATE_SUCC_SENDING_TABLE);
    db.execSQL(CREATE_NOTIFICATIONS_TABLE);
    db.execSQL(CREATE_RECEIVES_TABLE);
}

@Override
public void onUpgrade(SQLiteDatabase db, int i, int i2) {
    db.execSQL("DROP TABLE IF EXISTS " + GROUPS);
    db.execSQL("DROP TABLE IF EXISTS " + NOTIFICATIONS);
    db.execSQL("DROP TABLE IF EXISTS " + A_GROUP);
    db.execSQL("DROP TABLE IF EXISTS " + MESSAGES);
    db.execSQL("DROP TABLE IF EXISTS " + REPORTING);
    db.execSQL("DROP TABLE IF EXISTS " + SUCC_SENDING);
    db.execSQL("DROP TABLE IF EXISTS " + RECEIVES); // new table
    onCreate(db);

My new table is RECEIVES.

Aucun commentaire:

Enregistrer un commentaire