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

Don't set a default value when there isn't a default specified
remotes/origin/stable6
Thomas Müller 13 years ago
commit 49e9f771ff
  1. 2
      lib/private/db/mdb2schemareader.php
  2. 4
      tests/lib/db/mdb2schemareader.php

@ -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;

@ -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());

Loading…
Cancel
Save