BaseMigrateController::refreshDatabase() renamed to truncateDatabase()

This commit is contained in:
Klimov Paul
2017-08-24 13:08:46 +03:00
parent 98a71d8b0d
commit 264831cf21
2 changed files with 9 additions and 12 deletions

View File

@ -9,6 +9,7 @@ namespace yii\console\controllers;
use Yii;
use yii\base\InvalidConfigException;
use yii\base\NotSupportedException;
use yii\console\Controller;
use yii\console\Exception;
use yii\console\ExitCode;
@ -447,7 +448,8 @@ abstract class BaseMigrateController extends Controller
if ($this->confirm(
"Are you sure you want to reset the database and start the migration from the beginning?\nAll data will be lost irreversibly!")) {
$this->refreshDatabase();
$this->truncateDatabase();
$this->actionUp();
} else {
$this->stdout('Action was cancelled by user. Nothing has been performed.');
}
@ -906,16 +908,14 @@ abstract class BaseMigrateController extends Controller
}
/**
* Truncates the database and reapplies all migrations from the beginning.
*
* This method will simply print a message in the base class implementation.
* It should be overwritten in subclasses to implement the task of clearing the database.
*
* Truncates the database.
* This method should be overwritten in subclasses to implement the task of clearing the database.
* @throws NotSupportedException if not overridden
* @since 2.0.13
*/
protected function refreshDatabase()
protected function truncateDatabase()
{
$this->stdout('This command is not implemented in ' . get_class($this) . "\n");
throw new NotSupportedException('This command is not implemented in ' . get_class($this));
}
/**