Fixes #12904: Fixed lowercase table name in migrations

This commit is contained in:
Alexander Zlakomanov
2016-11-08 23:39:44 +03:00
committed by Alexander Makarov
parent 84397914a4
commit b48b1a0657
17 changed files with 226 additions and 209 deletions

View File

@ -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) {