diff --git a/tests/serverpod_test_server/lib/test_util/migration_test_utils.dart b/tests/serverpod_test_server/lib/test_util/migration_test_utils.dart index 2009e58e7b..f7130e3c04 100644 --- a/tests/serverpod_test_server/lib/test_util/migration_test_utils.dart +++ b/tests/serverpod_test_server/lib/test_util/migration_test_utils.dart @@ -65,6 +65,7 @@ abstract class MigrationTestUtils { required Client serviceClient, }) async { removeAllTaggedMigrations(); + removeRepairMigration(); _removeMigrationTestProtocolFolder(); if (resetSql != null) { await _resetDatabase(resetSql: resetSql, serviceClient: serviceClient); @@ -73,6 +74,13 @@ abstract class MigrationTestUtils { await _setDatabaseMigrationToLatestInRegistry(serviceClient: serviceClient); } + static void removeRepairMigration() { + var repairMigrationDirectory = _repairMigrationDirectory(); + if (repairMigrationDirectory.existsSync()) { + repairMigrationDirectory.deleteSync(recursive: true); + } + } + static void removeAllTaggedMigrations() { for (var entity in _migrationsProjectDirectory().listSync()) { if (entity is Directory) { @@ -117,10 +125,19 @@ abstract class MigrationTestUtils { 'migration_test_protocol_files', )); - static Directory _migrationsProjectDirectory() => Directory(path.join( + static Directory _migrationDirectory() => Directory(path.join( Directory.current.path, 'generated', 'migration', + )); + + static Directory _repairMigrationDirectory() => Directory(path.join( + _migrationDirectory().path, + 'repair', + )); + + static Directory _migrationsProjectDirectory() => Directory(path.join( + _migrationDirectory().path, 'migrations', 'serverpod_test', ));