addOption('--drop-views', null, InputOption::VALUE_NONE, 'Drop views along with tenant tables.', null); $this->setName('tenants:migrate-fresh'); } public function handle(): int { tenancy()->runForMultiple($this->getTenants(), function ($tenant) { $this->components->info("Tenant: {$tenant->getTenantKey()}"); $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, ]); }); }); return 0; } }