fix(test): make song-sections rollback guard test resilient to new migrations

This commit is contained in:
Thorsten Bus 2026-07-06 01:31:20 +02:00
parent 1df04c70e0
commit ea4b868650

View file

@ -45,8 +45,10 @@
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Destruktive Migration');
// The guarded migration (create_song_sections_and_rescope_slides) is 3rd from the top
// of the migration stack (2 newer migrations were added after it).
// Rolling back 3 steps reaches the destructive guard and triggers the RuntimeException.
Artisan::call('migrate:rollback', ['--step' => 3]);
// create_song_sections_and_rescope_slides is a destructive migration whose down()
// throws by design. RefreshDatabase applies every migration in a single batch, so a
// full-batch rollback proceeds newest -> oldest and reaches the guard before touching
// anything older. This stays correct no matter how many migrations are added above the
// guard later: they simply roll back first, then the guard throws the RuntimeException.
Artisan::call('migrate:rollback');
});