Use newMigrationPath and newMigrationNamespace if sourceNamespaces and sourcePaths are not specified#333
Use newMigrationPath and newMigrationNamespace if sourceNamespaces and sourcePaths are not specified#333
newMigrationPath and newMigrationNamespace if sourceNamespaces and sourcePaths are not specified#333Conversation
Tigrov
commented
Mar 19, 2026
| Q | A |
|---|---|
| Is bugfix? | ✔️/❌ |
| New feature? | ✔️/❌ |
| Breaks BC? | ✔️/❌ |
…es` and `sourcePaths` are not specified
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #333 +/- ##
============================================
- Coverage 12.91% 12.74% -0.17%
- Complexity 293 299 +6
============================================
Files 20 20
Lines 945 957 +12
============================================
Hits 122 122
- Misses 823 835 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Good idea, @Tigrov. Need a CHANGELOG for it. |
There was a problem hiding this comment.
Pull request overview
This PR updates migration discovery for migrate:up so that when sourceNamespaces/sourcePaths are not provided, the service falls back to newMigrationNamespace/newMigrationPath, aligning runtime behavior with common configuration patterns and improving developer ergonomics.
Changes:
- Extend
MigrationService::before('migrate:up')validation to acceptnewMigrationNamespace/newMigrationPathas valid migration sources. - Refactor migration source resolution into
MigrationService::findSourcePaths()and use it for scanning and loading migrations. - Add/update tests and documentation to cover and describe the fallback behavior (plus a small docs typo fix).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Common/Command/AbstractUpdateCommandTest.php | Adds coverage for running updates when sourcePaths/sourceNamespaces are empty but newMigrationPath/newMigrationNamespace are set. |
| src/Service/MigrationService.php | Introduces findSourcePaths() and uses it to discover migrations, including fallback to newMigration* settings. |
| docs/guide/pt-BR/usage-with-yii-console.md | Documents the new fallback behavior (pt-BR). |
| docs/guide/pt-BR/usage-standalone.md | Updates standalone example to setNewMigrationPath() and fixes helper key typo (pt-BR). |
| docs/guide/en/usage-with-yii-console.md | Documents the new fallback behavior (EN). |
| docs/guide/en/usage-standalone.md | Updates standalone example to setNewMigrationPath() and fixes helper key typo (EN). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>