Commit 6a02f3d3 authored by Kim Hemsø Rasmussen's avatar Kim Hemsø Rasmussen

Added some more types and column definitions.

parent 05b48352
......@@ -98,6 +98,11 @@ class DrizzlePlatform extends AbstractPlatform
'boolean' => 'boolean',
'varchar' => 'string',
'integer' => 'integer',
'blob' => 'text',
'decimal' => 'decimal',
'datetime' => 'datetime',
'date' => 'date',
'time' => 'time',
);
}
......@@ -147,7 +152,8 @@ class DrizzlePlatform extends AbstractPlatform
$database = 'DATABASE()';
}
return "SELECT COLUMN_NAME, COLUMN_TYPE, COLUMN_COMMENT, IS_NULLABLE, IS_AUTO_INCREMENT" .
return "SELECT COLUMN_NAME, COLUMN_TYPE, COLUMN_COMMENT, IS_NULLABLE, IS_AUTO_INCREMENT, CHARACTER_MAXIMUM_LENGTH, COLUMN_DEFAULT," .
" NUMERIC_PRECISION, NUMERIC_SCALE" .
" FROM DATA_DICTIONARY.COLUMNS" .
" WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME = '" . $table . "'";
}
......@@ -173,7 +179,6 @@ class DrizzlePlatform extends AbstractPlatform
$database = 'DATABASE()';
}
// INDEX_NAME AS 'key_name', COLUMN_NAME AS 'column_name', IS_USED_IN_PRIMARY AS 'primary', IS_UNIQUE=0 AS 'non_unique'
return "SELECT INDEX_NAME AS 'key_name', COLUMN_NAME AS 'column_name', IS_USED_IN_PRIMARY AS 'primary', IS_UNIQUE=0 AS 'non_unique'" .
" FROM DATA_DICTIONARY.INDEX_PARTS" .
" WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME='" . $table . "'";
......@@ -228,4 +233,22 @@ class DrizzlePlatform extends AbstractPlatform
return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY';
}
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
{
if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] == true) {
return 'TIMESTAMP';
} else {
return 'DATETIME';
}
}
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
{
return 'TIME';
}
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
{
return 'DATE';
}
}
......@@ -33,9 +33,15 @@ class DrizzleSchemaManager extends AbstractSchemaManager
$type = $this->_platform->getDoctrineTypeMapping($dbType);
$type = $this->extractDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type);
$tableColumn['COLUMN_COMMENT'] = $this->removeDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type);
$options = array(
'autoincrement' => (boolean)$tableColumn['IS_AUTO_INCREMENT'],
'notnull' => !(bool)$tableColumn['IS_NULLABLE'],
'length' => (int)$tableColumn['CHARACTER_MAXIMUM_LENGTH'],
'default' => empty($tableColumn['COLUMN_DEFAULT']) ? null : $tableColumn['COLUMN_DEFAULT'],
'autoincrement' => (bool)$tableColumn['IS_AUTO_INCREMENT'],
'scale' => (int)$tableColumn['NUMERIC_SCALE'],
'precision' => (int)$tableColumn['NUMERIC_PRECISION'],
'comment' => (isset($tableColumn['COLUMN_COMMENT']) ? $tableColumn['COLUMN_COMMENT'] : null),
);
......
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