mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Fix #17437: Fixed generating namespaced migrations
This commit is contained in:
committed by
Alexander Makarov
parent
a4a22ae1fb
commit
e50a07c30c
@ -17,6 +17,7 @@ use yii\console\ExitCode;
|
||||
use yii\db\MigrationInterface;
|
||||
use yii\helpers\Console;
|
||||
use yii\helpers\FileHelper;
|
||||
use yii\helpers\Inflector;
|
||||
|
||||
/**
|
||||
* BaseMigrateController is the base class for migrate controllers.
|
||||
@ -661,17 +662,15 @@ abstract class BaseMigrateController extends Controller
|
||||
if (strpos($name, '\\') !== false) {
|
||||
$namespace = substr($name, 0, strrpos($name, '\\'));
|
||||
$name = substr($name, strrpos($name, '\\') + 1);
|
||||
} else {
|
||||
if ($this->migrationPath === null) {
|
||||
$migrationNamespaces = $this->migrationNamespaces;
|
||||
$namespace = array_shift($migrationNamespaces);
|
||||
}
|
||||
} elseif ($this->migrationPath === null) {
|
||||
$migrationNamespaces = $this->migrationNamespaces;
|
||||
$namespace = array_shift($migrationNamespaces);
|
||||
}
|
||||
|
||||
if ($namespace === null) {
|
||||
$class = 'm' . gmdate('ymd_His') . '_' . $name;
|
||||
} else {
|
||||
$class = 'M' . gmdate('ymdHis') . ucfirst($name);
|
||||
$class = 'M' . gmdate('ymdHis') . Inflector::camelize($name);
|
||||
}
|
||||
|
||||
return [$namespace, $class];
|
||||
|
||||
Reference in New Issue
Block a user