mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 05:45:33 +08:00
Fixes #2156: yii migrate now automatically creates migrations directory if it does not exist
This commit is contained in:
@@ -93,6 +93,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #2124: Added support for UNION ALL queries (Ivan Pomortsev, iworker)
|
||||
- Enh #2132: Allow url of CSS and JS files registered in yii\web\View to be url alias (cebe)
|
||||
- Enh #2144: `Html` helper now supports rendering "data" attributes (qiangxue)
|
||||
- Enh #2156: `yii migrate` now automatically creates `migrations` directory if it does not exist (samdark)
|
||||
- Enh: Added `favicon.ico` and `robots.txt` to default application templates (samdark)
|
||||
- Enh: Added `Widget::autoIdPrefix` to support prefixing automatically generated widget IDs (qiangxue)
|
||||
- Enh: Support for file aliases in console command 'message' (omnilight)
|
||||
|
||||
@@ -14,6 +14,7 @@ use yii\console\Controller;
|
||||
use yii\db\Connection;
|
||||
use yii\db\Query;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\FileHelper;
|
||||
|
||||
/**
|
||||
* This command manages application migrations.
|
||||
@@ -105,15 +106,16 @@ class MigrateController extends Controller
|
||||
* This method is invoked right before an action is to be executed (after all possible filters.)
|
||||
* It checks the existence of the [[migrationPath]].
|
||||
* @param \yii\base\Action $action the action to be executed.
|
||||
* @throws Exception if db component isn't configured
|
||||
* @return boolean whether the action should continue to be executed.
|
||||
* @throws Exception if the migration directory does not exist.
|
||||
*/
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (parent::beforeAction($action)) {
|
||||
$path = Yii::getAlias($this->migrationPath);
|
||||
if (!is_dir($path)) {
|
||||
throw new Exception("The migration directory \"{$path}\" does not exist.");
|
||||
echo "";
|
||||
FileHelper::createDirectory($path);
|
||||
}
|
||||
$this->migrationPath = $path;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user