2014-05-14 23:24:20 +10:00
|
|
|
<?php namespace System\Console;
|
|
|
|
|
2022-02-24 20:29:53 -06:00
|
|
|
use Winter\Storm\Console\Command;
|
2014-05-14 23:24:20 +10:00
|
|
|
use System\Classes\UpdateManager;
|
|
|
|
|
2017-03-16 17:08:20 +11:00
|
|
|
/**
|
|
|
|
* Console command to tear down the database.
|
|
|
|
*
|
2021-03-10 15:02:53 -06:00
|
|
|
* This destroys all database tables that are registered for Winter and all plugins.
|
2017-03-16 17:08:20 +11:00
|
|
|
*
|
2021-03-10 15:02:53 -06:00
|
|
|
* @package winter\wn-system-module
|
2017-03-16 17:08:20 +11:00
|
|
|
* @author Alexey Bobkov, Samuel Georges
|
|
|
|
*/
|
2021-03-10 15:02:53 -06:00
|
|
|
class WinterDown extends Command
|
2014-05-14 23:24:20 +10:00
|
|
|
{
|
2022-02-24 20:29:53 -06:00
|
|
|
use \Winter\Storm\Console\Traits\ConfirmsWithInput;
|
2014-07-25 17:51:36 +10:00
|
|
|
|
2014-05-14 23:24:20 +10:00
|
|
|
/**
|
2022-02-24 20:29:53 -06:00
|
|
|
* @var string|null The default command name for lazy loading.
|
2014-05-14 23:24:20 +10:00
|
|
|
*/
|
2022-02-24 20:29:53 -06:00
|
|
|
protected static $defaultName = 'winter:down';
|
2014-05-14 23:24:20 +10:00
|
|
|
|
|
|
|
/**
|
2022-02-24 20:29:53 -06:00
|
|
|
* @var string The name and signature of this command.
|
|
|
|
*/
|
|
|
|
protected $signature = 'winter:down
|
2022-02-24 22:02:01 -06:00
|
|
|
{--f|force : Force the operation to run and ignore production warnings and confirmation questionss.}';
|
2022-02-24 20:29:53 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string The console command description.
|
2014-05-14 23:24:20 +10:00
|
|
|
*/
|
2021-03-10 15:02:53 -06:00
|
|
|
protected $description = 'Destroys all database tables for Winter and all plugins.';
|
2014-05-14 23:24:20 +10:00
|
|
|
|
2021-04-03 08:39:45 -06:00
|
|
|
/**
|
|
|
|
* Create a new command instance.
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
2022-02-24 20:29:53 -06:00
|
|
|
// Register aliases for backwards compatibility with October & Laravel
|
|
|
|
$this->setAliases(['october:down', 'migrate:reset']);
|
2021-04-03 08:39:45 -06:00
|
|
|
}
|
|
|
|
|
2014-05-14 23:24:20 +10:00
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*/
|
2022-02-24 20:29:53 -06:00
|
|
|
public function handle(): int
|
2014-05-14 23:24:20 +10:00
|
|
|
{
|
2022-02-24 20:29:53 -06:00
|
|
|
if (!$this->confirmWithInput(
|
|
|
|
"This will completely delete all database tables in use with your Winter installation.",
|
|
|
|
"DELETE"
|
|
|
|
)) {
|
|
|
|
return 1;
|
2014-10-18 11:58:50 +02:00
|
|
|
}
|
2014-05-14 23:24:20 +10:00
|
|
|
|
2017-05-20 09:03:58 +10:00
|
|
|
UpdateManager::instance()
|
|
|
|
->setNotesOutput($this->output)
|
2022-02-24 20:29:53 -06:00
|
|
|
->uninstall();
|
2014-07-25 17:51:36 +10:00
|
|
|
|
2022-02-24 20:29:53 -06:00
|
|
|
return 0;
|
2014-05-14 23:24:20 +10:00
|
|
|
}
|
2014-10-18 11:58:50 +02:00
|
|
|
}
|