Merge pull request #5813 from owncloud/fix-4736-master

Don't set a default value when there isn't a default specified
This commit is contained in:
Thomas Müller 2013-11-15 01:06:38 -08:00
commit 49e9f771ff
2 changed files with 3 additions and 3 deletions

View File

@ -186,7 +186,7 @@ class MDB2SchemaReader {
} }
} }
if (isset($name) && isset($type)) { if (isset($name) && isset($type)) {
if (empty($options['default'])) { if (isset($options['default']) && empty($options['default'])) {
if (empty($options['notnull']) || !$options['notnull']) { if (empty($options['notnull']) || !$options['notnull']) {
unset($options['default']); unset($options['default']);
$options['notnull'] = false; $options['notnull'] = false;

View File

@ -57,13 +57,13 @@ class MDB2SchemaReader extends \PHPUnit_Framework_TestCase {
$this->assertNull($table->getColumn('clobfield')->getLength()); $this->assertNull($table->getColumn('clobfield')->getLength());
$this->assertFalse($table->getColumn('clobfield')->getAutoincrement()); $this->assertFalse($table->getColumn('clobfield')->getAutoincrement());
$this->assertSame('', $table->getColumn('clobfield')->getDefault()); $this->assertNull($table->getColumn('clobfield')->getDefault());
$this->assertTrue($table->getColumn('clobfield')->getNotnull()); $this->assertTrue($table->getColumn('clobfield')->getNotnull());
$this->assertInstanceOf('Doctrine\DBAL\Types\TextType', $table->getColumn('clobfield')->getType()); $this->assertInstanceOf('Doctrine\DBAL\Types\TextType', $table->getColumn('clobfield')->getType());
$this->assertNull($table->getColumn('booleanfield')->getLength()); $this->assertNull($table->getColumn('booleanfield')->getLength());
$this->assertFalse($table->getColumn('booleanfield')->getAutoincrement()); $this->assertFalse($table->getColumn('booleanfield')->getAutoincrement());
$this->assertFalse($table->getColumn('booleanfield')->getDefault()); $this->assertNull($table->getColumn('booleanfield')->getDefault());
$this->assertInstanceOf('Doctrine\DBAL\Types\BooleanType', $table->getColumn('booleanfield')->getType()); $this->assertInstanceOf('Doctrine\DBAL\Types\BooleanType', $table->getColumn('booleanfield')->getType());
$this->assertTrue($table->getColumn('booleanfield_true')->getDefault()); $this->assertTrue($table->getColumn('booleanfield_true')->getDefault());