Skip to content

[12.x] add migrate:redo command (alias of migrate:refresh --step=1)#56066

Closed
adammatysiak wants to merge 1 commit intolaravel:masterfrom
adammatysiak:migrate-redo
Closed

[12.x] add migrate:redo command (alias of migrate:refresh --step=1)#56066
adammatysiak wants to merge 1 commit intolaravel:masterfrom
adammatysiak:migrate-redo

Conversation

@adammatysiak
Copy link
Copy Markdown

One-line alias for migrate:refresh --step=1 that mirrors Rails’ db:migrate:redo, saves keystrokes when iterating on a single migration.

New RedoCommand extending RefreshCommand, registered in MigrationServiceProvider.

3 console tests added in tests\Database\DatabaseMigrationRedoCommandTest.php mirroring the Refresh command.

Non-breaking backwards compatibility.

The alternative is using the existing migrate:refresh --step=1; this alias is for convenience.

The docs would need to be updated under src/docs/12.x/migrations.md:

### Redo

`php artisan migrate:redo`

Rolls back the most recent batch and immediately re-runs it.  
It is equivalent to `migrate:refresh --step=1`.

@adammatysiak adammatysiak changed the title Add migrate:redo command (alias of migrate:refresh --step=1) [12.x] add migrate:redo command (alias of migrate:refresh --step=1) Jun 17, 2025
@taylorotwell
Copy link
Copy Markdown
Member

You could probably just bash alias migrate:refresh --step=1

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.

2 participants