mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:34:04 +00:00
Move migration event dispatching inside try block
This commit is contained in:
parent
7e9294d40c
commit
31e30767b4
1 changed files with 3 additions and 4 deletions
|
|
@ -52,18 +52,17 @@ class Migrate extends MigrateCommand
|
||||||
tenancy()->runForMultiple($this->option('tenants'), function ($tenant) {
|
tenancy()->runForMultiple($this->option('tenants'), function ($tenant) {
|
||||||
$this->line("Tenant: {$tenant->getTenantKey()}");
|
$this->line("Tenant: {$tenant->getTenantKey()}");
|
||||||
|
|
||||||
event(new MigratingDatabase($tenant));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
event(new MigratingDatabase($tenant));
|
||||||
// Migrate
|
// Migrate
|
||||||
parent::handle();
|
parent::handle();
|
||||||
|
|
||||||
|
event(new DatabaseMigrated($tenant));
|
||||||
} catch (Exception $th) {
|
} catch (Exception $th) {
|
||||||
if (! $this->option('skip-failing')) {
|
if (! $this->option('skip-failing')) {
|
||||||
throw $th;
|
throw $th;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event(new DatabaseMigrated($tenant));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue