@Test public void onUpgrade_fromVersion8() { createVersion8Database(database); ContentValues contentValues = createVersion8Form(); database.insert(FORMS_TABLE_NAME, null, contentValues); new FormDatabaseMigrator().onUpgrade(database, 8); try (Cursor cursor = database.rawQuery("SELECT * FROM " + FORMS_TABLE_NAME + ";", new String[]{})) { assertThat(cursor.getColumnCount(), is(17)); assertThat(cursor.getCount(), is(1)); cursor.moveToFirst(); assertThat(cursor.getString(cursor.getColumnIndex(DISPLAY_NAME)), is(contentValues.getAsString(DISPLAY_NAME))); assertThat(cursor.getString(cursor.getColumnIndex(DESCRIPTION)), is(contentValues.getAsString(DESCRIPTION))); assertThat(cursor.getString(cursor.getColumnIndex(JR_FORM_ID)), is(contentValues.getAsString(JR_FORM_ID))); assertThat(cursor.getString(cursor.getColumnIndex(JR_VERSION)), is(contentValues.getAsString(JR_VERSION))); assertThat(cursor.getString(cursor.getColumnIndex(MD5_HASH)), is(contentValues.getAsString(MD5_HASH))); assertThat(cursor.getInt(cursor.getColumnIndex(DATE)), is(contentValues.getAsInteger(DATE))); assertThat(cursor.getString(cursor.getColumnIndex(FORM_MEDIA_PATH)), is(contentValues.getAsString(FORM_MEDIA_PATH))); assertThat(cursor.getString(cursor.getColumnIndex(FORM_FILE_PATH)), is(contentValues.getAsString(FORM_FILE_PATH))); assertThat(cursor.getString(cursor.getColumnIndex(LANGUAGE)), is(contentValues.getAsString(LANGUAGE))); assertThat(cursor.getString(cursor.getColumnIndex(SUBMISSION_URI)), is(contentValues.getAsString(SUBMISSION_URI))); assertThat(cursor.getString(cursor.getColumnIndex(BASE64_RSA_PUBLIC_KEY)), is(contentValues.getAsString(BASE64_RSA_PUBLIC_KEY))); assertThat(cursor.getString(cursor.getColumnIndex(JRCACHE_FILE_PATH)), is(contentValues.getAsString(JRCACHE_FILE_PATH))); assertThat(cursor.getString(cursor.getColumnIndex(AUTO_SEND)), is(contentValues.getAsString(AUTO_SEND))); assertThat(cursor.getString(cursor.getColumnIndex(AUTO_DELETE)), is(contentValues.getAsString(AUTO_DELETE))); assertThat(cursor.getString(cursor.getColumnIndex(GEOMETRY_XPATH)), is(contentValues.getAsString(GEOMETRY_XPATH))); assertThat(cursor.isNull(cursor.getColumnIndex(DELETED_DATE)), is(true)); } }
@SuppressWarnings({"checkstyle:FallThrough"}) public void onUpgrade(SQLiteDatabase db, int oldVersion) throws SQLException { switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); case 7: upgradeToVersion8(db); case 8: upgradeToVersion9(db); case 9: upgradeToVersion10(db); } }
FormDatabaseMigrator { @SuppressWarnings({"checkstyle:FallThrough"}) public void onUpgrade(SQLiteDatabase db, int oldVersion) throws SQLException { switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); case 7: upgradeToVersion8(db); case 8: upgradeToVersion9(db); case 9: upgradeToVersion10(db); } } }
FormDatabaseMigrator { @SuppressWarnings({"checkstyle:FallThrough"}) public void onUpgrade(SQLiteDatabase db, int oldVersion) throws SQLException { switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); case 7: upgradeToVersion8(db); case 8: upgradeToVersion9(db); case 9: upgradeToVersion10(db); } }  }
FormDatabaseMigrator { @SuppressWarnings({"checkstyle:FallThrough"}) public void onUpgrade(SQLiteDatabase db, int oldVersion) throws SQLException { switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); case 7: upgradeToVersion8(db); case 8: upgradeToVersion9(db); case 9: upgradeToVersion10(db); } }  void onCreate(SQLiteDatabase db); @SuppressWarnings({"checkstyle:FallThrough"}) void onUpgrade(SQLiteDatabase db, int oldVersion); void onDowngrade(SQLiteDatabase db); }
FormDatabaseMigrator { @SuppressWarnings({"checkstyle:FallThrough"}) public void onUpgrade(SQLiteDatabase db, int oldVersion) throws SQLException { switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); case 7: upgradeToVersion8(db); case 8: upgradeToVersion9(db); case 9: upgradeToVersion10(db); } }  void onCreate(SQLiteDatabase db); @SuppressWarnings({"checkstyle:FallThrough"}) void onUpgrade(SQLiteDatabase db, int oldVersion); void onDowngrade(SQLiteDatabase db);  }