Commit 125f3b17 authored by beberlei's avatar beberlei

Apply array_change_key_case in...

Apply array_change_key_case in MysqlSchemaManager::_getPortableColumnDefinition() and adapt further code to work with it
parent 95135c95
......@@ -85,7 +85,9 @@ class MySqlSchemaManager extends AbstractSchemaManager
*/
protected function _getPortableTableColumnDefinition($tableColumn)
{
$dbType = strtolower($tableColumn['Type']);
$tableColumn = array_change_key_case($tableColumn, CASE_LOWER);
$dbType = strtolower($tableColumn['type']);
$dbType = strtok($dbType, '(), ');
if (isset($tableColumn['length'])) {
$length = $tableColumn['length'];
......@@ -114,7 +116,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
case 'real':
case 'numeric':
case 'decimal':
if(preg_match('([A-Za-z]+\(([0-9]+)\,([0-9]+)\))', $tableColumn['Type'], $match)) {
if(preg_match('([A-Za-z]+\(([0-9]+)\,([0-9]+)\))', $tableColumn['type'], $match)) {
$precision = $match[1];
$scale = $match[2];
$length = null;
......@@ -149,11 +151,11 @@ class MySqlSchemaManager extends AbstractSchemaManager
'length' => $length,
'unsigned' => (bool)$unsigned,
'fixed' => (bool)$fixed,
'default' => $tableColumn['Default'],
'notnull' => (bool) ($tableColumn['Null'] != 'YES'),
'default' => $tableColumn['default'],
'notnull' => (bool) ($tableColumn['null'] != 'YES'),
'scale' => null,
'precision' => null,
'autoincrement' => (bool) (strpos($tableColumn['Extra'], 'auto_increment') !== false),
'autoincrement' => (bool) (strpos($tableColumn['extra'], 'auto_increment') !== false),
);
if ($scale !== null && $precision !== null) {
......@@ -161,7 +163,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
$options['precision'] = $precision;
}
return new Column($tableColumn['Field'], \Doctrine\DBAL\Types\Type::getType($type), $options);
return new Column($tableColumn['field'], \Doctrine\DBAL\Types\Type::getType($type), $options);
}
public function _getPortableTableForeignKeyDefinition($tableForeignKey)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment