@Test public void onDowngrade_fromVersionWithMissingColumn() { FormDatabaseMigrator formDatabaseMigrator = new FormDatabaseMigrator(); database.execSQL("CREATE TABLE IF NOT EXISTS " + FORMS_TABLE_NAME + " (" + _ID + " integer primary key, " + DISPLAY_NAME + " text not null, " + DESCRIPTION + " text, " + JR_FORM_ID + " text not null, " + JR_VERSION + " text, " + MD5_HASH + " text not null, " + DATE + " integer not null, " + FORM_MEDIA_PATH + " text not null, " + FORM_FILE_PATH + " text not null, " + LANGUAGE + " text, " + SUBMISSION_URI + " text, " + BASE64_RSA_PUBLIC_KEY + " text, " + AUTO_SEND + " text, " + AUTO_DELETE + " text, " + "lastDetectedFormVersionHash" + " text, " + GEOMETRY_XPATH + " text);"); ContentValues contentValues = createVersion8Form(); contentValues.remove(JRCACHE_FILE_PATH); database.insert(FORMS_TABLE_NAME, null, contentValues); formDatabaseMigrator.onDowngrade(database); try (Cursor cursor = database.rawQuery("SELECT * FROM " + FORMS_TABLE_NAME + ";", new String[]{})) { assertThat(cursor.getColumnCount(), is(17)); assertThat(cursor.getCount(), is(0)); assertThat(asList(cursor.getColumnNames()), is(CURRENT_VERSION_COLUMNS)); } }
public void onDowngrade(SQLiteDatabase db) throws SQLException { SQLiteUtils.dropTable(db, FORMS_TABLE_NAME); createFormsTableV10(db); }
FormDatabaseMigrator { public void onDowngrade(SQLiteDatabase db) throws SQLException { SQLiteUtils.dropTable(db, FORMS_TABLE_NAME); createFormsTableV10(db); } }
FormDatabaseMigrator { public void onDowngrade(SQLiteDatabase db) throws SQLException { SQLiteUtils.dropTable(db, FORMS_TABLE_NAME); createFormsTableV10(db); }  }
FormDatabaseMigrator { public void onDowngrade(SQLiteDatabase db) throws SQLException { SQLiteUtils.dropTable(db, FORMS_TABLE_NAME); createFormsTableV10(db); }  void onCreate(SQLiteDatabase db); @SuppressWarnings({"checkstyle:FallThrough"}) void onUpgrade(SQLiteDatabase db, int oldVersion); void onDowngrade(SQLiteDatabase db); }
FormDatabaseMigrator { public void onDowngrade(SQLiteDatabase db) throws SQLException { SQLiteUtils.dropTable(db, FORMS_TABLE_NAME); createFormsTableV10(db); }  void onCreate(SQLiteDatabase db); @SuppressWarnings({"checkstyle:FallThrough"}) void onUpgrade(SQLiteDatabase db, int oldVersion); void onDowngrade(SQLiteDatabase db);  }