Register the native database commands under their own names - #142
Open
gwleuverink wants to merge 3 commits into
Open
Register the native database commands under their own names#142gwleuverink wants to merge 3 commits into
gwleuverink wants to merge 3 commits into
Conversation
Laravel 13.24 changed FreshCommand and WipeCommand to declare $signature where they used $name. Illuminate\Console\Command::__construct() gives $signature precedence, and the child inherits the parent's, so overriding $name no longer renames anything. Both commands ended up registered under Laravel's names, which breaks artisan list and points migrate:fresh at the NativePHP database. Declaring the signature keeps the native name and carries the parent's options across, which parent::handle() still reads. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
gwleuverink
marked this pull request as ready for review
August 18, 2026 14:16
gwleuverink
requested review from
SRWieZ and
simonhamp
and removed request for
simonhamp
August 20, 2026 11:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Laravel 13.24 and up,
FreshCommandandWipeDatabaseCommandregister under Laravel's names instead of their own.artisan listdies with "The native:migrate:fresh command cannot be found because it is registered under multiple names" (#134), andphp artisan migrate:freshsilently wipesdatabase/nativephp.sqliteinstead of the app's database (#135).Both commands rename their parent by setting
$name. Laravel 13.24 changedIlluminate\Database\Console\Migrations\FreshCommandandIlluminate\Database\Console\WipeCommandto declare$signaturewhere they used$namebefore.Illuminate\Console\Command::__construct()checksisset($this->signature)first, and the child inherits the parent's, so$nameis never read.native:db:wipebecomes a seconddb:wipe, and because Laravel's ownmigrate:freshcallsdb:wipeby name, it lands in NativePHP's version, which switches the default connection tonativephpbefore dropping every table.Declaring
$signatureon both keeps the native name and carries the parent's options across, whichparent::handle()still reads. The option lists are identical on Laravel 10, 11, 12 and 13, so this holds everywhere the package is supported.While in here, all four native database commands are put on one convention, since the inconsistency between them is what made this bite.
Illuminate\Console\Application::resolve()reads#[AsCommand]by reflection and registers the class lazily under that name, then construction names it again from the signature. When the two disagree you get #134, so they have to stay in step.WipeDatabaseCommandhad no attribute at all and was the only one being eagerly instantiated, so it gets one.The attribute's
descriptionargument was dead on all of them.Command::__construct()applies$this->descriptionafterconfigureFromAttributes(), sonative:migrateandnative:seedwere inheriting Laravel's wording and listing as "Run the database migrations" and "Seed the database with records", with nothing to say they target the development database. Descriptions now live in$descriptionand the attribute carries the name only, which is what the framework's own commands do.Checked in a throwaway Laravel 13.26 app on
nativephp/desktop2.2.1. Before:artisan listerrors, and onemigrate:freshdrops all 10 tables fromnativephp.sqlitewhiledatabase.sqliteis left untouched. After: all four native commands list separately with their own descriptions and their options intact,migrate:freshhits the app database again, andnative:db:wipestill drops only the NativePHP one. Suite is green on 11, 12 and 13, and the added tests fail on 13.26 without these changes.Fixes #134
Fixes #135