mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 13:58:55 +08:00
Fixes #12904: Fixed lowercase table name in migrations
This commit is contained in:
committed by
Alexander Makarov
parent
84397914a4
commit
b48b1a0657
@ -269,8 +269,8 @@ class MigrateController extends BaseMigrateController
|
||||
$table = null;
|
||||
if (preg_match('/^create_junction(?:_table_for_|_for_|_)(.+)_and_(.+)_tables?$/', $name, $matches)) {
|
||||
$templateFile = $this->generatorTemplateFiles['create_junction'];
|
||||
$firstTable = mb_strtolower($matches[1], Yii::$app->charset);
|
||||
$secondTable = mb_strtolower($matches[2], Yii::$app->charset);
|
||||
$firstTable = $matches[1];
|
||||
$secondTable = $matches[2];
|
||||
|
||||
$fields = array_merge(
|
||||
[
|
||||
@ -300,18 +300,18 @@ class MigrateController extends BaseMigrateController
|
||||
$table = $firstTable . '_' . $secondTable;
|
||||
} elseif (preg_match('/^add_(.+)_columns?_to_(.+)_table$/', $name, $matches)) {
|
||||
$templateFile = $this->generatorTemplateFiles['add_column'];
|
||||
$table = mb_strtolower($matches[2], Yii::$app->charset);
|
||||
$table = $matches[2];
|
||||
} elseif (preg_match('/^drop_(.+)_columns?_from_(.+)_table$/', $name, $matches)) {
|
||||
$templateFile = $this->generatorTemplateFiles['drop_column'];
|
||||
$table = mb_strtolower($matches[2], Yii::$app->charset);
|
||||
$table = $matches[2];
|
||||
} elseif (preg_match('/^create_(.+)_table$/', $name, $matches)) {
|
||||
$this->addDefaultPrimaryKey($fields);
|
||||
$templateFile = $this->generatorTemplateFiles['create_table'];
|
||||
$table = mb_strtolower($matches[1], Yii::$app->charset);
|
||||
$table = $matches[1];
|
||||
} elseif (preg_match('/^drop_(.+)_table$/', $name, $matches)) {
|
||||
$this->addDefaultPrimaryKey($fields);
|
||||
$templateFile = $this->generatorTemplateFiles['drop_table'];
|
||||
$table = mb_strtolower($matches[1], Yii::$app->charset);
|
||||
$table = $matches[1];
|
||||
}
|
||||
|
||||
foreach ($foreignKeys as $column => $foreignKey) {
|
||||
|
||||
Reference in New Issue
Block a user