1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 09:54:05 +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,24 +46,24 @@ class Migrate extends MigrateCommand
return 1; return 1;
} }
try { foreach ($this->option('tenants') as $tenant) {
tenancy()->runForMultiple($this->option('tenants'), function ($tenant) { try {
$this->line("Tenant: {$tenant->getTenantKey()}"); tenancy()->find($tenant)->run(function($tenant) {
$this->line("Tenant: {$tenant->getTenantKey()}");
event(new MigratingDatabase($tenant)); event(new MigratingDatabase($tenant));
// Migrate // Migrate
parent::handle(); parent::handle();
event(new DatabaseMigrated($tenant)); event(new DatabaseMigrated($tenant));
}); });
} catch (TenantDatabaseDoesNotExistException|QueryException $th) {
return 0; if (! $this->option('skip-failing')) {
} catch (TenantDatabaseDoesNotExistException|QueryException $th) { throw $th;
if (! $this->option('skip-failing')) { }
throw $th;
} }
return 1;
} }
return 0;
} }
} }