@Test public void onUpgrade1to3() { helper.onUpgrade(database, 1, 3); verify2Upgrade(); verify3Upgrade(); }
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion < 2) { try { db.execSQL("ALTER TABLE article ADD COLUMN saved integer not null DEFAULT 0"); } catch(Exception e) { } } if (oldVersion < 3) { try { db.execSQL(tables[2].getCreateStatement()); db.execSQL(tables[3].getCreateStatement()); db.execSQL(tables[2].getIndexStatements()[0]); db.execSQL(tables[2].getIndexStatements()[1]); db.execSQL(tables[3].getIndexStatements()[0]); db.execSQL("ALTER TABLE article ADD COLUMN source_id integer"); db.execSQL(tables[0].getIndexStatements()[1]); } catch(Exception e) { } } }
DatabaseSQLiteHelper extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion < 2) { try { db.execSQL("ALTER TABLE article ADD COLUMN saved integer not null DEFAULT 0"); } catch(Exception e) { } } if (oldVersion < 3) { try { db.execSQL(tables[2].getCreateStatement()); db.execSQL(tables[3].getCreateStatement()); db.execSQL(tables[2].getIndexStatements()[0]); db.execSQL(tables[2].getIndexStatements()[1]); db.execSQL(tables[3].getIndexStatements()[0]); db.execSQL("ALTER TABLE article ADD COLUMN source_id integer"); db.execSQL(tables[0].getIndexStatements()[1]); } catch(Exception e) { } } } }
DatabaseSQLiteHelper extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion < 2) { try { db.execSQL("ALTER TABLE article ADD COLUMN saved integer not null DEFAULT 0"); } catch(Exception e) { } } if (oldVersion < 3) { try { db.execSQL(tables[2].getCreateStatement()); db.execSQL(tables[3].getCreateStatement()); db.execSQL(tables[2].getIndexStatements()[0]); db.execSQL(tables[2].getIndexStatements()[1]); db.execSQL(tables[3].getIndexStatements()[0]); db.execSQL("ALTER TABLE article ADD COLUMN source_id integer"); db.execSQL(tables[0].getIndexStatements()[1]); } catch(Exception e) { } } } DatabaseSQLiteHelper(Context context); }
DatabaseSQLiteHelper extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion < 2) { try { db.execSQL("ALTER TABLE article ADD COLUMN saved integer not null DEFAULT 0"); } catch(Exception e) { } } if (oldVersion < 3) { try { db.execSQL(tables[2].getCreateStatement()); db.execSQL(tables[3].getCreateStatement()); db.execSQL(tables[2].getIndexStatements()[0]); db.execSQL(tables[2].getIndexStatements()[1]); db.execSQL(tables[3].getIndexStatements()[0]); db.execSQL("ALTER TABLE article ADD COLUMN source_id integer"); db.execSQL(tables[0].getIndexStatements()[1]); } catch(Exception e) { } } } DatabaseSQLiteHelper(Context context); @Override void onCreate(SQLiteDatabase db); @Override void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); void onDrop(SQLiteDatabase db); }
DatabaseSQLiteHelper extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion < 2) { try { db.execSQL("ALTER TABLE article ADD COLUMN saved integer not null DEFAULT 0"); } catch(Exception e) { } } if (oldVersion < 3) { try { db.execSQL(tables[2].getCreateStatement()); db.execSQL(tables[3].getCreateStatement()); db.execSQL(tables[2].getIndexStatements()[0]); db.execSQL(tables[2].getIndexStatements()[1]); db.execSQL(tables[3].getIndexStatements()[0]); db.execSQL("ALTER TABLE article ADD COLUMN source_id integer"); db.execSQL(tables[0].getIndexStatements()[1]); } catch(Exception e) { } } } DatabaseSQLiteHelper(Context context); @Override void onCreate(SQLiteDatabase db); @Override void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); void onDrop(SQLiteDatabase db);  }