Commit 42f429a2 authored by Miloslav Kmet's avatar Miloslav Kmet Committed by Benjamin Eberlei

Fixed doctrine column type comments

parent b066e54f
......@@ -1095,7 +1095,7 @@ abstract class AbstractPlatform
$sql = $this->_getCreateTableSQL($tableName, $columns, $options);
if ($this->supportsCommentOnStatement()) {
foreach ($table->getColumns() AS $column) {
if ($column->getComment()) {
if ($this->getColumnComment($column)) {
$sql[] = $this->getCommentOnColumnSQL($tableName, $column->getName(), $this->getColumnComment($column));
}
}
......
......@@ -326,6 +326,16 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this->assertEquals($this->getAlterTableColumnCommentsSQL(), $this->_platform->getAlterTableSQL($tableDiff));
}
public function testCreateTableColumnTypeComments()
{
$table = new \Doctrine\DBAL\Schema\Table('test');
$table->addColumn('id', 'integer');
$table->addColumn('data', 'array');
$table->setPrimaryKey(array('id'));
$this->assertEquals($this->getCreateTableColumnTypeCommentsSQL(), $this->_platform->getCreateTableSQL($table));
}
public function getCreateTableColumnCommentsSQL()
{
$this->markTestSkipped('Platform does not support Column comments.');
......@@ -336,6 +346,11 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this->markTestSkipped('Platform does not support Column comments.');
}
public function getCreateTableColumnTypeCommentsSQL()
{
$this->markTestSkipped('Platform does not support Column comments.');
}
/**
* @group DBAL-45
*/
......
......@@ -204,4 +204,9 @@ class MySqlPlatformTest extends AbstractPlatformTestCase
{
return array("ALTER TABLE mytable ADD quota INT NOT NULL COMMENT 'A comment', CHANGE bar baz VARCHAR(255) NOT NULL COMMENT 'B comment'");
}
public function getCreateTableColumnTypeCommentsSQL()
{
return array("CREATE TABLE test (id INT NOT NULL, data LONGTEXT NOT NULL COMMENT '(DC2Type:array)', PRIMARY KEY(id)) ENGINE = InnoDB");
}
}
\ No newline at end of file
......@@ -195,6 +195,14 @@ class OraclePlatformTest extends AbstractPlatformTestCase
);
}
public function getCreateTableColumnTypeCommentsSQL()
{
return array(
"CREATE TABLE test (id NUMBER(10) NOT NULL, data CLOB NOT NULL, PRIMARY KEY(id))",
"COMMENT ON COLUMN test.data IS '(DC2Type:array)'"
);
}
public function getAlterTableColumnCommentsSQL()
{
return array(
......
......@@ -216,4 +216,12 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
"COMMENT ON COLUMN mytable.baz IS 'B comment'",
);
}
public function getCreateTableColumnTypeCommentsSQL()
{
return array(
"CREATE TABLE test (id INT NOT NULL, data TEXT NOT NULL, PRIMARY KEY(id))",
"COMMENT ON COLUMN test.data IS '(DC2Type:array)'"
);
}
}
\ No newline at end of file
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