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:
parent
146570f7e9
commit
bfd2669fda
1 changed files with 15 additions and 15 deletions
|
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue