mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 21:34:04 +00:00
Add drop of db views on migrate fresh command (#812)
* Optionally handle drop of table views on MigrateFresh @stancl I managed to make the modification discussed here #811 Afaik (and I can understand) this is the easiest way to handle it, but I'm open to discuss. * Remove redundant store variable * code style Co-authored-by: Samuel Štancl <samuel@archte.ch>
This commit is contained in:
parent
5b9b384526
commit
b4a4eab949
1 changed files with 4 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ namespace Stancl\Tenancy\Commands;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Stancl\Tenancy\Concerns\DealsWithMigrations;
|
use Stancl\Tenancy\Concerns\DealsWithMigrations;
|
||||||
use Stancl\Tenancy\Concerns\HasATenantsOption;
|
use Stancl\Tenancy\Concerns\HasATenantsOption;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
|
||||||
final class MigrateFresh extends Command
|
final class MigrateFresh extends Command
|
||||||
{
|
{
|
||||||
|
|
@ -23,6 +24,8 @@ final class MigrateFresh extends Command
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->addOption('--drop-views', null, InputOption::VALUE_NONE, 'Drop views along with tenant tables.', null);
|
||||||
|
|
||||||
$this->setName('tenants:migrate-fresh');
|
$this->setName('tenants:migrate-fresh');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,6 +40,7 @@ final class MigrateFresh extends Command
|
||||||
$this->info('Dropping tables.');
|
$this->info('Dropping tables.');
|
||||||
$this->call('db:wipe', array_filter([
|
$this->call('db:wipe', array_filter([
|
||||||
'--database' => 'tenant',
|
'--database' => 'tenant',
|
||||||
|
'--drop-views' => $this->option('drop-views'),
|
||||||
'--force' => true,
|
'--force' => true,
|
||||||
]));
|
]));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue