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

Using laravel components

This commit is contained in:
j.stein 2022-10-09 00:11:37 -04:00
parent 6ee93d0441
commit 2f15dd5473
10 changed files with 142 additions and 59 deletions

View file

@ -26,20 +26,23 @@ final class MigrateFresh extends Command
public function handle(): void
{
tenancy()->runForMultiple($this->getTenants(), function ($tenant) {
$this->info('Dropping tables.');
$this->call('db:wipe', array_filter([
'--database' => 'tenant',
'--drop-views' => $this->option('drop-views'),
'--force' => true,
]));
$this->components->info("Tenant: {$tenant->getTenantKey()}");
$this->info('Migrating.');
$this->callSilent('tenants:migrate', [
'--tenants' => [$tenant->getTenantKey()],
'--force' => true,
]);
$this->components->task('Dropping tables', function () {
$this->callSilently('db:wipe', array_filter([
'--database' => 'tenant',
'--drop-views' => $this->option('drop-views'),
'--force' => true,
]));
});
$this->components->task('Migrating', function () use ($tenant){
$this->callSilent('tenants:migrate', [
'--tenants' => [$tenant->getTenantKey()],
'--force' => true,
]);
});
});
$this->info('Done.');
}
}