DBAL: compare text length
This commit is contained in:
@@ -28,12 +28,11 @@
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Utils\Database\DBAL\Schema;
|
||||
use Doctrine\DBAL\Schema\Column;
|
||||
|
||||
use Doctrine\DBAL\Schema\Column;
|
||||
|
||||
class Comparator extends \Doctrine\DBAL\Schema\Comparator
|
||||
{
|
||||
|
||||
public function diffColumn(Column $column1, Column $column2)
|
||||
{
|
||||
$changedProperties = array();
|
||||
@@ -80,6 +79,15 @@ class Comparator extends \Doctrine\DBAL\Schema\Comparator
|
||||
}
|
||||
}
|
||||
|
||||
if ($column1->getType() instanceof \Doctrine\DBAL\Types\TextType) {
|
||||
$length1 = $column1->getLength() ?: 16777215/* mediumtext length*/;
|
||||
$length2 = $column2->getLength() ?: 16777215;
|
||||
|
||||
if ($length2 > $length1) {
|
||||
$changedProperties[] = 'length';
|
||||
}
|
||||
}
|
||||
|
||||
if ($column1->getType() instanceof \Doctrine\DBAL\Types\DecimalType) {
|
||||
if (($column1->getPrecision()?:10) != ($column2->getPrecision()?:10)) {
|
||||
$changedProperties[] = 'precision';
|
||||
|
||||
@@ -47,7 +47,7 @@ return [
|
||||
],
|
||||
'data' => [
|
||||
'type' => 'text',
|
||||
'dbType' => 'longtext',
|
||||
'len' => 16777216,
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user