Skip to content

[13.x] Don't report skipped migrations as pending in migrate:status - #61989

Merged
taylorotwell merged 6 commits into
laravel:13.xfrom
jackbayliss:skipped-migrations-migrate-status
Oct 15, 2026
Merged

taylorotwell merged 6 commits into
laravel:13.xfrom
jackbayliss:skipped-migrations-migrate-status

Conversation

@jackbayliss

@jackbayliss jackbayliss commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

We can use shouldRun() in migrations, but when it returns false (ie a feature isn't enabled), migrate:status still shows the migration as pending despite knowing it aint gonna run.

public function shouldRun(): bool
{
    return Feature::active('new-api'); // false 
}

This PR shows migrations where shouldRun() returns false as Skipped (same as the migrate command), so --pending only counts migrations that will actually run.

Since shouldRun() could depend on an earlier pending migration (ie checking a table it creates exists), once we hit a migration that will actually run, everything after it shows as Pending like today.

Sooo, I think this covers the flaws I can think of - I've also added tests for the command as I couldn't see any.

So before:
Screenshot 2026-10-15 at 13 56 17

but, its ofc skipped
Screenshot 2026-10-15 at 13 56 33

after: This labels it as skipped, as we run status before migrate..
image

So migrate:status --pending never comes back clean, which is a pain if you use it to check if there's actually anything to migrate.

Many deployment scripts do something like $this->callSilently(StatusCommand::class, ['--pending' => 100]) === 100 to decide whether to go into maintenance mode. Right now those apps go down for migrations that are just going to be skipped anyway.

Happy for it to go in the bin if you're not sold, but had to try.

@github-actions

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@jackbayliss
jackbayliss marked this pull request as ready for review October 15, 2026 13:29
@taylorotwell
taylorotwell merged commit ff0d6b9 into laravel:13.x Oct 15, 2026
45 of 62 checks passed
@ziadoz

ziadoz commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Glad to see this get merged. I tried twice in a previous release to add the exact same thing.

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.

3 participants