Repository navigation
[4.x] commands: add $scopeTenantsQuery - #1528
Conversation
Commands using HasTenantOptions now have a static $scopeTenantsQuery
closure that receives the tenants query:
Migrate::$scopeTenantsQuery = fn (Builder $q) => $q->where('region', 'eu');
It's declared in the trait, so each command class has its own scope.
The scope is applied as a nested where after --tenants, --skip-tenants
and --with-pending, so it's always combined with those options, including
when the scope uses orWhere(). This also covers the tenant chunks built
for parallel runs.
MigrateFresh's nested tenants:migrate call and the MigrateDatabase and
SeedDatabase jobs run for tenants that were already selected, so they
bypass the scope using withoutTenantsQueryScope().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1528 +/- ##
============================================
+ Coverage 88.31% 88.67% +0.35%
- Complexity 1327 1380 +53
============================================
Files 188 188
Lines 3782 3937 +155
============================================
+ Hits 3340 3491 +151
- Misses 442 446 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Commands using HasTenantOptions now have a static $scopeTenantsQuery closure that receives the tenants query:
It's declared in the trait, so each command class has its own scope. The scope is applied as a nested where after --tenants, --skip-tenants and --with-pending, so it's always combined with those options, including when the scope uses orWhere(). This also covers the tenant chunks built for parallel runs.
MigrateFresh's nested tenants:migrate call and the MigrateDatabase and SeedDatabase jobs run for tenants that were already selected, so they bypass the scope using withoutTenantsQueryScope().
Summary by CodeRabbit
New Features
Bug Fixes