Skip to content

Commit

Permalink
doctrine#2930 Added diff length for TextType
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro Boiko committed Nov 30, 2017
1 parent a4d7acd commit 244844c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Doctrine/DBAL/Schema/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ public function diffColumn(Column $column1, Column $column2)
$changedProperties[] = 'default';
}

if (($properties1['type'] instanceof Types\StringType && ! $properties1['type'] instanceof Types\GuidType) ||
if ((($properties1['type'] instanceof Types\TextType || $properties1['type'] instanceof Types\StringType) &&
! $properties1['type'] instanceof Types\GuidType) ||
$properties1['type'] instanceof Types\BinaryType
) {
// check if value of length is set at all, default value assumed otherwise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,4 +477,23 @@ public function testEnsureDefaultsAreUnescapedFromSchemaIntrospection() : void
$onlineTable = $this->_sm->listTableDetails("test_column_defaults_with_create");
self::assertSame($default, $onlineTable->getColumn('col1')->getDefault());
}

/**
* @group DBAL-2930
*/
public function testComparatorForTextType()
{
$first = new Table('test_text_length');
$first->addColumn('col_medium', 'text', ['length' => 1000]);
$this->_sm->createTable($first);
$table = $this->_sm->createSchema()->getTable('test_text_length');
$table->changeColumn('col_medium', ['length' => 16777215]);

$comparator = new Comparator();

self::assertNotFalse(
$comparator->diffTable($first, $table),
'Differences should be detected in the changing length of the text field.'
);
}
}

0 comments on commit 244844c

Please sign in to comment.