mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:44:04 +00:00
fix tenants:list and tenants:dump --prune
This commit is contained in:
parent
9f94505cb4
commit
f8512886a0
2 changed files with 14 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ namespace Stancl\Tenancy\Commands;
|
|||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Database\ConnectionResolverInterface;
|
||||
use Illuminate\Database\Console\DumpCommand;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
|
|
@ -41,8 +42,20 @@ class TenantDump extends DumpCommand
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Prevent the parent command from pruning the central migrations folder
|
||||
$prune = $this->option('prune');
|
||||
$this->input->setOption('prune', false);
|
||||
|
||||
tenancy()->run($tenant, fn () => parent::handle($connections, $dispatcher));
|
||||
|
||||
if ($prune) {
|
||||
(new Filesystem)->deleteDirectory(
|
||||
database_path('migrations/tenant'), preserve: true
|
||||
);
|
||||
|
||||
$this->components->info('Tenant migrations pruned.');
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ declare(strict_types=1);
|
|||
namespace Stancl\Tenancy\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Stancl\Tenancy\Contracts\SingleDomainTenant;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue