mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 14:28:27 +08:00
BaseMigrateController::refreshDatabase()
renamed to truncateDatabase()
This commit is contained in:
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user