Problem Statement
The CLI migration commands (migrations:run, migrations:fresh, migrations:rollback) discover migrations only from the top-level Database/Migrations/ directory. They do not scan subdirectories.
The underlying SchemaRunner::discoverFromPath() method already supports recursive scanning via a $recursive parameter, but the CLI commands never pass true:
// In RunMigrationsCommandNew, FreshMigrationsCommand, RollbackMigrationsCommand:
$count = $this->runner->discoverFromPath($migrationsPath, $namespace);
// $recursive defaults to false
This means organizing migrations in subdirectories by domain is silently ignored — no warning, no error:
Database/Migrations/
Master/ ← not discovered
Sustainability/ ← not discovered
Lms/ ← not discovered
Proposed Solution
Pass true for the $recursive parameter in all CLI migration commands:
$count = $this->runner->discoverFromPath($migrationsPath, $namespace, true);
This applies to:
RunMigrationsCommandNew
FreshMigrationsCommand
RollbackMigrationsCommand
DryRunMigrationsCommand
MigrationsStatusCommand
And the same for seeders discovery in those commands.
Alternatives Considered
- Adding a
--recursive CLI flag — but subdirectory organization is a common pattern and should work by default.
- Keeping migrations flat in one directory — works but doesn't scale for multi-domain projects.
Breaking Change
No
Additional Context
The discoverFromPath method already handles recursive namespace resolution correctly. The only change needed is passing true in the CLI commands. This was discovered while building a multi-domain project with Database/Migrations/Master/ subdirectory — migrations were silently not found until moved to the top-level directory.
Problem Statement
The CLI migration commands (
migrations:run,migrations:fresh,migrations:rollback) discover migrations only from the top-levelDatabase/Migrations/directory. They do not scan subdirectories.The underlying
SchemaRunner::discoverFromPath()method already supports recursive scanning via a$recursiveparameter, but the CLI commands never passtrue:This means organizing migrations in subdirectories by domain is silently ignored — no warning, no error:
Proposed Solution
Pass
truefor the$recursiveparameter in all CLI migration commands:This applies to:
RunMigrationsCommandNewFreshMigrationsCommandRollbackMigrationsCommandDryRunMigrationsCommandMigrationsStatusCommandAnd the same for seeders discovery in those commands.
Alternatives Considered
--recursiveCLI flag — but subdirectory organization is a common pattern and should work by default.Breaking Change
No
Additional Context
The
discoverFromPathmethod already handles recursive namespace resolution correctly. The only change needed is passingtruein the CLI commands. This was discovered while building a multi-domain project withDatabase/Migrations/Master/subdirectory — migrations were silently not found until moved to the top-level directory.