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

Update Migrate command

This commit is contained in:
lukinovec 2023-01-06 06:35:23 +01:00
parent 146570f7e9
commit bfd2669fda

View file

@ -46,8 +46,9 @@ class Migrate extends MigrateCommand
return 1; return 1;
} }
foreach ($this->option('tenants') as $tenant) {
try { try {
tenancy()->runForMultiple($this->option('tenants'), function ($tenant) { tenancy()->find($tenant)->run(function($tenant) {
$this->line("Tenant: {$tenant->getTenantKey()}"); $this->line("Tenant: {$tenant->getTenantKey()}");
event(new MigratingDatabase($tenant)); event(new MigratingDatabase($tenant));
@ -56,14 +57,13 @@ class Migrate extends MigrateCommand
event(new DatabaseMigrated($tenant)); event(new DatabaseMigrated($tenant));
}); });
return 0;
} catch (TenantDatabaseDoesNotExistException|QueryException $th) { } catch (TenantDatabaseDoesNotExistException|QueryException $th) {
if (! $this->option('skip-failing')) { if (! $this->option('skip-failing')) {
throw $th; throw $th;
} }
return 1;
} }
} }
return 0;
}
} }