1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 15:34:04 +00:00

Move migration event dispatching inside try block

This commit is contained in:
lukinovec 2022-09-20 16:06:15 +02:00
parent 7e9294d40c
commit 31e30767b4

View file

@ -52,18 +52,17 @@ class Migrate extends MigrateCommand
tenancy()->runForMultiple($this->option('tenants'), function ($tenant) {
$this->line("Tenant: {$tenant->getTenantKey()}");
event(new MigratingDatabase($tenant));
try {
event(new MigratingDatabase($tenant));
// Migrate
parent::handle();
event(new DatabaseMigrated($tenant));
} catch (Exception $th) {
if (! $this->option('skip-failing')) {
throw $th;
}
}
event(new DatabaseMigrated($tenant));
});
}
}