Commit a92784a1 authored by Benjamin Eberlei's avatar Benjamin Eberlei

[DDC-2843] Fix default value of PostgreSQL boolean columns.

parent 6e76a638
......@@ -343,6 +343,14 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
break;
case 'bool':
case 'boolean':
if ($tableColumn['default'] === 'true') {
$tableColumn['default'] = true;
}
if ($tableColumn['default'] === 'false') {
$tableColumn['default'] = false;
}
$length = null;
break;
case 'text':
......
......@@ -261,6 +261,25 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->assertEquals('foo', $databaseTable->getColumn('def')->getDefault());
}
/**
* @group DDC-2843
*/
public function testBooleanDefault()
{
$table = new \Doctrine\DBAL\Schema\Table('ddc2843_bools');
$table->addColumn('id', 'integer');
$table->addColumn('checked', 'boolean', array('default' => false));
$this->_sm->createTable($table);
$databaseTable = $this->_sm->listTableDetails($table->getName());
$c = new \Doctrine\DBAL\Schema\Comparator();
$diff = $c->diffTable($table, $databaseTable);
$this->assertFalse($diff);
}
}
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