Source:
public void run() { if (!databasePath.exists()) { InternalMigrationStatus migrationStatus = new VersionOneToVersionTwoMigrationStatus( jobIdentifier, MigrationStatus.Status.DB_NOT_PRESENT, 0, 0 ); onUpdate(migrationStatus); return; } SQLiteDatabase sqLiteDatabase = SQLiteDatabase.openDatabase(databasePath.getAbsolutePath(), null, 0); SqlDatabaseWrapper database = new SqlDatabaseWrapper(sqLiteDatabase); FilePersistence filePersistence = FilePersistenceCreator.newInternalFilePersistenceCreator(context).create(); String basePath = filePersistence.basePath().path(); filePersistence.initialiseWith(context); PartialDownloadMigrationExtractor partialDownloadMigrationExtractor = new PartialDownloadMigrationExtractor(database); MigrationExtractor migrationExtractor = new MigrationExtractor(database, filePersistence); List<Migration> partialMigrations = partialDownloadMigrationExtractor.extractMigrations(); List<Migration> completeMigrations = migrationExtractor.extractMigrations(); DownloadsPersistence downloadsPersistence = RoomDownloadsPersistence.newInstance(context); LocalFilesDirectory localFilesDirectory = new AndroidLocalFilesDirectory(context); UnlinkedDataRemover unlinkedDataRemover = new UnlinkedDataRemover(downloadsPersistence, localFilesDirectory); int totalNumberOfMigrations = partialMigrations.size() + completeMigrations.size(); InternalMigrationStatus migrationStatus = new VersionOneToVersionTwoMigrationStatus( jobIdentifier, MigrationStatus.Status.DB_NOT_PRESENT, 0, totalNumberOfMigrations ); unlinkedDataRemover.remove(); migrationStatus.markAsExtracting(); onUpdate(migrationStatus); migrationStatus.markAsMigrating(); onUpdate(migrationStatus); migratePartialDownloads(migrationStatus, database, partialMigrations, downloadsPersistence, basePath); migrateCompleteDownloads(migrationStatus, database, completeMigrations, downloadsPersistence, basePath); deleteVersionOneDatabase(migrationStatus, database); migrationStatus.markAsComplete(); onUpdate(migrationStatus); }

Target:
public void run() { if (!databasePath.exists()) { InternalMigrationStatus migrationStatus = new VersionOneToVersionTwoMigrationStatus( jobIdentifier, MigrationStatus.Status.DB_NOT_PRESENT, NO_COMPLETED_MIGRATIONS, NO_MIGRATIONS ); onUpdate(migrationStatus); return; } SQLiteDatabase sqLiteDatabase = SQLiteDatabase.openDatabase(databasePath.getAbsolutePath(), null, 0); SqlDatabaseWrapper database = new SqlDatabaseWrapper(sqLiteDatabase); FilePersistence filePersistence = FilePersistenceCreator.newInternalFilePersistenceCreator(context).create(); String basePath = filePersistence.basePath().path(); filePersistence.initialiseWith(context); PartialDownloadMigrationExtractor partialDownloadMigrationExtractor = new PartialDownloadMigrationExtractor(database); MigrationExtractor migrationExtractor = new MigrationExtractor(database, filePersistence); List<Migration> partialMigrations = partialDownloadMigrationExtractor.extractMigrations(); List<Migration> completeMigrations = migrationExtractor.extractMigrations(); DownloadsPersistence downloadsPersistence = RoomDownloadsPersistence.newInstance(context); LocalFilesDirectory localFilesDirectory = new AndroidLocalFilesDirectory(context); UnlinkedDataRemover unlinkedDataRemover = new UnlinkedDataRemover(downloadsPersistence, localFilesDirectory); int totalNumberOfMigrations = partialMigrations.size() + completeMigrations.size(); InternalMigrationStatus migrationStatus = new VersionOneToVersionTwoMigrationStatus( jobIdentifier, MigrationStatus.Status.DB_NOT_PRESENT, NO_COMPLETED_MIGRATIONS, totalNumberOfMigrations ); unlinkedDataRemover.remove(); migrationStatus.markAsExtracting(); onUpdate(migrationStatus); migrationStatus.markAsMigrating(); onUpdate(migrationStatus); migratePartialDownloads(migrationStatus, database, partialMigrations, downloadsPersistence, basePath); migrateCompleteDownloads(migrationStatus, database, completeMigrations, downloadsPersistence, basePath); deleteVersionOneDatabase(migrationStatus, database); migrationStatus.markAsComplete(); onUpdate(migrationStatus); }