Skip to content

Display migrations to be rolled back before confirmation#58864

Draft
mdrakash wants to merge 1 commit intolaravel:12.xfrom
mdrakash:feature/rollback-preview-confirmation
Draft

Display migrations to be rolled back before confirmation#58864
mdrakash wants to merge 1 commit intolaravel:12.xfrom
mdrakash:feature/rollback-preview-confirmation

Conversation

@mdrakash
Copy link

Fixes #58861
When running migrate:rollback in production, Laravel may rollback
previous successful migrations if the last migration failed silently
(e.g., during CI/CD). This PR adds:

  • Display of migrations that will be rolled back
  • User confirmation before rollback
  • Skips confirmation if --force is used

What to Implement:
- Determine which migrations will be rolled back
- Display their names before execution
- Ask for confirmation
- Skip confirmation if --force is provided
- Keep production safeguards intact
@crynobone
Copy link
Member

test are failing

@crynobone crynobone marked this pull request as draft February 16, 2026 10:05
foreach ($migrations as $migration) {
$this->line(' - '.$migration->migration);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, you could use Symfony's listing() method here:

Suggested change
$this->line('Migrations to be rolled back:');
$this->output->listing($migrations->map(fn ($migration) $migration->migration));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display migrations to be rolled back before confirmation

3 participants

Comments