1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 15:24:03 +00:00

Default to including pending tenants in MigrateDatabase and SeedDatabase

Now that tenants are created with pending_since right away, the migrate and seed database jobs need to include pending tenants for creating pending tenants to work fully. The jobs can still exclude pending tenants if $includePending is set to false.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
lukinovec 2026-04-28 10:55:42 +02:00
parent b592d3dad4
commit 66114e6835
2 changed files with 14 additions and 0 deletions

View file

@ -17,6 +17,12 @@ class MigrateDatabase implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Should pending tenants be included while migrating,
* regardless of the tenancy.pending.include_in_queries config value.
*/
public static bool $includePending = true;
public function __construct(
protected TenantWithDatabase&Model $tenant,
) {}
@ -25,6 +31,7 @@ class MigrateDatabase implements ShouldQueue
{
Artisan::call('tenants:migrate', [
'--tenants' => [$this->tenant->getTenantKey()],
'--with-pending' => static::$includePending,
]);
}
}

View file

@ -17,6 +17,12 @@ class SeedDatabase implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Should pending tenants be included while seeding,
* regardless of the tenancy.pending.include_in_queries config value.
*/
public static bool $includePending = true;
public function __construct(
protected TenantWithDatabase&Model $tenant,
) {}
@ -25,6 +31,7 @@ class SeedDatabase implements ShouldQueue
{
Artisan::call('tenants:seed', [
'--tenants' => [$this->tenant->getTenantKey()],
'--with-pending' => static::$includePending,
]);
}
}