Commit 035b079c authored by Kim Hemsø Rasmussen's avatar Kim Hemsø Rasmussen

Use DATA_TYPE to figure out column type. Fixed triming of column names for spaces and etc.

parent 0b03421a
...@@ -134,6 +134,8 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -134,6 +134,8 @@ class DrizzlePlatform extends AbstractPlatform
'datetime' => 'datetime', 'datetime' => 'datetime',
'date' => 'date', 'date' => 'date',
'time' => 'time', 'time' => 'time',
'text' => 'text',
'timestamp' => 'datetime',
); );
} }
...@@ -183,7 +185,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -183,7 +185,7 @@ class DrizzlePlatform extends AbstractPlatform
$database = 'DATABASE()'; $database = 'DATABASE()';
} }
return "SELECT COLUMN_NAME, COLUMN_TYPE, COLUMN_COMMENT, IS_NULLABLE, IS_AUTO_INCREMENT, CHARACTER_MAXIMUM_LENGTH, COLUMN_DEFAULT," . return "SELECT COLUMN_NAME, DATA_TYPE, COLUMN_COMMENT, IS_NULLABLE, IS_AUTO_INCREMENT, CHARACTER_MAXIMUM_LENGTH, COLUMN_DEFAULT," .
" NUMERIC_PRECISION, NUMERIC_SCALE" . " NUMERIC_PRECISION, NUMERIC_SCALE" .
" FROM DATA_DICTIONARY.COLUMNS" . " FROM DATA_DICTIONARY.COLUMNS" .
" WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME = '" . $table . "'"; " WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME = '" . $table . "'";
......
...@@ -29,7 +29,7 @@ class DrizzleSchemaManager extends AbstractSchemaManager ...@@ -29,7 +29,7 @@ class DrizzleSchemaManager extends AbstractSchemaManager
protected function _getPortableTableColumnDefinition($tableColumn) protected function _getPortableTableColumnDefinition($tableColumn)
{ {
$tableName = $tableColumn['COLUMN_NAME']; $tableName = $tableColumn['COLUMN_NAME'];
$dbType = strtolower($tableColumn['COLUMN_TYPE']); $dbType = strtolower($tableColumn['DATA_TYPE']);
$type = $this->_platform->getDoctrineTypeMapping($dbType); $type = $this->_platform->getDoctrineTypeMapping($dbType);
$type = $this->extractDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type); $type = $this->extractDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type);
...@@ -62,12 +62,12 @@ class DrizzleSchemaManager extends AbstractSchemaManager ...@@ -62,12 +62,12 @@ class DrizzleSchemaManager extends AbstractSchemaManager
{ {
$columns = array(); $columns = array();
foreach (explode(',', $tableForeignKey['CONSTRAINT_COLUMNS']) as $value) { foreach (explode(',', $tableForeignKey['CONSTRAINT_COLUMNS']) as $value) {
$columns[] = trim($value, '`'); $columns[] = trim($value, ' `');
} }
$ref_columns = array(); $ref_columns = array();
foreach (explode(',', $tableForeignKey['REFERENCED_TABLE_COLUMNS']) as $value) { foreach (explode(',', $tableForeignKey['REFERENCED_TABLE_COLUMNS']) as $value) {
$ref_columns[] = trim($value, '`'); $ref_columns[] = trim($value, ' `');
} }
return new ForeignKeyConstraint( return new ForeignKeyConstraint(
......
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