Source:
<code>protected void validateMigration(SupportSQLiteDatabase db) { final Map<String, EntityBundle> tables = mDatabaseBundle.getEntitiesByTableName(); for (EntityBundle entity : tables.values()) { if (entity instanceof FtsEntityBundle) { final FtsTableInfo expected = toFtsTableInfo((FtsEntityBundle) entity); final FtsTableInfo found = FtsTableInfo.read(db, entity.getTableName()); if (!expected.equals(found)) { throw new IllegalStateException( "Migration failed.\nExpected:" + expected + "\nFound:" + found); } } else { final TableInfo expected = toTableInfo(entity); final TableInfo found = TableInfo.read(db, entity.getTableName()); if (!expected.equals(found)) { throw new IllegalStateException( "Migration failed.\nExpected:" + expected + " \nfound:" + found); } } } if (mVerifyDroppedTables) { List<String> excludeList = new ArrayList<>(); <START> excludeList.add(Room.MASTER_TABLE_NAME); excludeList.add("android_metadata"); excludeList.add("sqlite_sequence"); for (EntityBundle entity : mDatabaseBundle.getEntities()) { if (entity instanceof FtsEntityBundle) { excludeList.addAll(((FtsEntityBundle) entity).getShadowTableNames()); } } StringBuilder query = new StringBuilder("SELECT name FROM sqlite_master " + "WHERE type='table' AND name NOT IN ("); for (int i = 0; i < excludeList.size(); i++) { if (i == 0) { query.append("?"); } else { query.append(",?"); } } <END> query.append(")"); Cursor cursor = db.query(query.toString(), excludeList.toArray(new String[0])); try { while (cursor.moveToNext()) { final String tableName = cursor.getString(0); if (!tables.containsKey(tableName)) { throw new IllegalStateException("Migration failed. Unexpected table " + tableName); } } } finally { cursor.close(); } } }</code><technical_language>instead of exclusion here, add shadow tables a "expectedTables" set keys tables shadow tables</technical_language>

Target:
protected void validateMigration(SupportSQLiteDatabase db) { final Map<String, EntityBundle> tables = mDatabaseBundle.getEntitiesByTableName(); for (EntityBundle entity : tables.values()) { if (entity instanceof FtsEntityBundle) { final FtsTableInfo expected = toFtsTableInfo((FtsEntityBundle) entity); final FtsTableInfo found = FtsTableInfo.read(db, entity.getTableName()); if (!expected.equals(found)) { throw new IllegalStateException( "Migration failed.\nExpected:" + expected + "\nFound:" + found); } } else { final TableInfo expected = toTableInfo(entity); final TableInfo found = TableInfo.read(db, entity.getTableName()); if (!expected.equals(found)) { throw new IllegalStateException( "Migration failed.\nExpected:" + expected + " \nfound:" + found); } } } if (mVerifyDroppedTables) { Set<String> expectedTables = new HashSet<>(); for (EntityBundle entity : tables.values()) { expectedTables.add(entity.getTableName()); if (entity instanceof FtsEntityBundle) { expectedTables.addAll(((FtsEntityBundle) entity).getShadowTableNames()); } } Cursor cursor = db.query("SELECT name FROM sqlite_master WHERE type='table'" + " AND name NOT IN(?, ?, ?)", new String[]{Room.MASTER_TABLE_NAME, "android_metadata", "sqlite_sequence"}); try { while (cursor.moveToNext()) { final String tableName = cursor.getString(0); if (!expectedTables.contains(tableName)) { throw new IllegalStateException("Migration failed. Unexpected table " + tableName); } } } finally { cursor.close(); } } }