1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 00:14:04 +00:00

Terminating pipelines (#527)

* Return false from CreateDatabase job

* Terminating pipeline tests
This commit is contained in:
Samuel Štancl 2020-11-15 16:26:26 +01:00 committed by GitHub
parent 8f12dd8829
commit 126afcd0dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 81 additions and 6 deletions

View file

@ -31,12 +31,15 @@ class CreateDatabase implements ShouldQueue
{
event(new CreatingDatabase($this->tenant));
if ($this->tenant->getInternal('create_database') !== false) {
$databaseManager->ensureTenantCanBeCreated($this->tenant);
$this->tenant->database()->makeCredentials();
$this->tenant->database()->manager()->createDatabase($this->tenant);
event(new DatabaseCreated($this->tenant));
// Terminate execution of this job & other jobs in the pipeline
if ($this->tenant->getInternal('create_database') === false) {
return false;
}
$databaseManager->ensureTenantCanBeCreated($this->tenant);
$this->tenant->database()->makeCredentials();
$this->tenant->database()->manager()->createDatabase($this->tenant);
event(new DatabaseCreated($this->tenant));
}
}