Commit 7284d6f3 authored by Benjamin Eberlei's avatar Benjamin Eberlei

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

parent ac0c0630
......@@ -258,6 +258,10 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$autoincrement = true;
}
if (preg_match("/^'(.*)'::.*$/", $tableColumn['default'], $matches)) {
$tableColumn['default'] = $matches[1];
}
if (stripos($tableColumn['default'], 'NULL') === 0) {
$tableColumn['default'] = null;
}
......
......@@ -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
......
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