mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 02:44:02 +00:00
Queued post-creation automigration
This commit is contained in:
parent
40f8fa346e
commit
071cc6f950
4 changed files with 52 additions and 3 deletions
|
|
@ -9,6 +9,7 @@ use Illuminate\Foundation\Application;
|
|||
use Illuminate\Support\Collection;
|
||||
use Stancl\Tenancy\Contracts\TenantCannotBeCreatedException;
|
||||
use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedException;
|
||||
use Stancl\Tenancy\Jobs\QueuedTenantDatabaseMigrator;
|
||||
|
||||
/**
|
||||
* @internal Class is subject to breaking changes in minor and patch versions.
|
||||
|
|
@ -64,9 +65,13 @@ class TenantManager
|
|||
$this->database->createDatabase($tenant);
|
||||
|
||||
if ($this->shouldMigrateAfterCreation()) {
|
||||
$this->artisan->call('tenants:migrate', [
|
||||
'--tenants' => [$tenant['id']],
|
||||
]);
|
||||
if ($this->shouldQueueMigration()) {
|
||||
QueuedTenantDatabaseMigrator::dispatch($tenant);
|
||||
} else {
|
||||
$this->artisan->call('tenants:migrate', [
|
||||
'--tenants' => [$tenant['id']],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue