winter/modules/system/console/WinterDown.php

64 lines
1.6 KiB
PHP
Raw Normal View History

2014-05-14 23:24:20 +10:00
<?php namespace System\Console;
use Winter\Storm\Console\Command;
2014-05-14 23:24:20 +10:00
use System\Classes\UpdateManager;
/**
* Console command to tear down the database.
*
* This destroys all database tables that are registered for Winter and all plugins.
*
* @package winter\wn-system-module
* @author Alexey Bobkov, Samuel Georges
*/
class WinterDown extends Command
2014-05-14 23:24:20 +10:00
{
use \Winter\Storm\Console\Traits\ConfirmsWithInput;
2014-05-14 23:24:20 +10:00
/**
* @var string|null The default command name for lazy loading.
2014-05-14 23:24:20 +10:00
*/
protected static $defaultName = 'winter:down';
2014-05-14 23:24:20 +10: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.}';
/**
* @var string The console command description.
2014-05-14 23:24:20 +10:00
*/
protected $description = 'Destroys all database tables for Winter and all plugins.';
2014-05-14 23:24:20 +10:00
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
// Register aliases for backwards compatibility with October & Laravel
$this->setAliases(['october:down', 'migrate:reset']);
}
2014-05-14 23:24:20 +10:00
/**
* Execute the console command.
*/
public function handle(): int
2014-05-14 23:24:20 +10: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)
->uninstall();
return 0;
2014-05-14 23:24:20 +10:00
}
2014-10-18 11:58:50 +02:00
}