Commit 28264a15 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge pull request #426 from deeky666/DBAL-569

[DBAL-569] Add support for column comments / commented types in SQL Server
parents bbc1e62d a6f5b3b0
......@@ -80,6 +80,8 @@ class SQLServerSchemaManager extends AbstractSchemaManager
}
$type = $this->_platform->getDoctrineTypeMapping($dbType);
$type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type);
$tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type);
switch ($type) {
case 'char':
......@@ -99,6 +101,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
'scale' => $tableColumn['scale'],
'precision' => $tableColumn['precision'],
'autoincrement' => (bool) $tableColumn['autoincrement'],
'comment' => $tableColumn['comment'] !== '' ? $tableColumn['comment'] : null,
);
$platformOptions = array(
......
......@@ -522,7 +522,9 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
*/
public function testGetColumnComment()
{
if (!$this->_conn->getDatabasePlatform()->supportsInlineColumnComments() && !$this->_conn->getDatabasePlatform()->supportsCommentOnStatement()) {
if ( ! $this->_conn->getDatabasePlatform()->supportsInlineColumnComments() &&
! $this->_conn->getDatabasePlatform()->supportsCommentOnStatement() &&
$this->_conn->getDatabasePlatform()->getName() != 'mssql') {
$this->markTestSkipped('Database does not support column comments.');
}
......@@ -556,7 +558,9 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
*/
public function testAutomaticallyAppendCommentOnMarkedColumns()
{
if (!$this->_conn->getDatabasePlatform()->supportsInlineColumnComments() && !$this->_conn->getDatabasePlatform()->supportsCommentOnStatement()) {
if ( ! $this->_conn->getDatabasePlatform()->supportsInlineColumnComments() &&
! $this->_conn->getDatabasePlatform()->supportsCommentOnStatement() &&
$this->_conn->getDatabasePlatform()->getName() != 'mssql') {
$this->markTestSkipped('Database does not support column comments.');
}
......
......@@ -28,6 +28,7 @@ class DBAL461Test extends \PHPUnit_Framework_TestCase
'precision' => 0,
'autoincrement' => false,
'collation' => 'foo',
'comment' => null,
));
$this->assertEquals('Decimal', (string)$column->getType());
......
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