Skip to content

Use newMigrationPath and newMigrationNamespace if sourceNamespaces and sourcePaths are not specified#333

Open
Tigrov wants to merge 2 commits intomasterfrom
use-newmigrationpath
Open

Use newMigrationPath and newMigrationNamespace if sourceNamespaces and sourcePaths are not specified#333
Tigrov wants to merge 2 commits intomasterfrom
use-newmigrationpath

Conversation

@Tigrov
Copy link
Copy Markdown
Member

@Tigrov Tigrov commented Mar 19, 2026

Q A
Is bugfix? ✔️/❌
New feature? ✔️/❌
Breaks BC? ✔️/❌

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 12.74%. Comparing base (38fdc07) to head (e56dc4f).

Files with missing lines Patch % Lines
src/Service/MigrationService.php 0.00% 20 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samdark samdark requested a review from Copilot March 19, 2026 20:01
@samdark
Copy link
Copy Markdown
Member

samdark commented Mar 19, 2026

Good idea, @Tigrov. Need a CHANGELOG for it.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 accept newMigrationNamespace/newMigrationPath as 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>
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