Commit 163d5790 authored by Benjamin Eberlei's avatar Benjamin Eberlei

[DBAL-511] Strip ::type syntax from default column definition to make it comparable.

parent 1d8d6bcf
...@@ -262,6 +262,10 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -262,6 +262,10 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$autoincrement = true; $autoincrement = true;
} }
if (preg_match("/^'(.*)'::.*$/", $tableColumn['default'], $matches)) {
$tableColumn['default'] = $matches[1];
}
if (stripos($tableColumn['default'], 'NULL') === 0) { if (stripos($tableColumn['default'], 'NULL') === 0) {
$tableColumn['default'] = null; $tableColumn['default'] = null;
} }
......
...@@ -244,6 +244,23 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -244,6 +244,23 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
} }
} }
} }
/**
* @group DBAL-511
*/
public function testDefaultValueCharacterVarying()
{
$testTable = new \Doctrine\DBAL\Schema\Table('dbal511_default');
$testTable->addColumn('id', 'integer');
$testTable->addColumn('def', 'string', array('default' => 'foo'));
$testTable->setPrimaryKey(array('id'));
$this->_sm->createTable($testTable);
$databaseTable = $this->_sm->listTableDetails($testTable->getName());
print_r($databaseTable);
}
} }
class MoneyType extends Type class MoneyType extends Type
......
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