Skip to content

Commit

Permalink
Revert some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Jan 19, 2025
1 parent 1ba6c6f commit 2ff7555
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/QueryBuilder/AbstractColumnDefinitionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ protected function buildType(ColumnInterface $column): string
{
$dbType = $this->getDbType($column);

if (empty($dbType) || $dbType[-1] === ')' || !$this->isAllowSize($dbType)) {
if (empty($dbType)
|| $dbType[-1] === ')'
|| !in_array(strtolower($dbType), static::TYPES_WITH_SIZE, true)
) {
return $dbType;
}

Expand All @@ -266,7 +269,7 @@ protected function buildType(ColumnInterface $column): string

$scale = $column->getScale();

if ($scale === null || !$this->isAllowScale($dbType)) {
if ($scale === null || !in_array(strtolower($dbType), static::TYPES_WITH_SCALE, true)) {
return "$dbType($size)";
}

Expand Down Expand Up @@ -305,20 +308,4 @@ protected function getDefaultUuidExpression(): string
{
return '';
}

/**
* Check if the database column type allow scale specification.
*/
protected function isAllowScale(string $dbType): bool
{
return in_array(strtolower($dbType), static::TYPES_WITH_SCALE, true);
}

/**
* Check if the database column type allow size specification.
*/
protected function isAllowSize(string $dbType): bool
{
return in_array(strtolower($dbType), static::TYPES_WITH_SIZE, true);
}
}

0 comments on commit 2ff7555

Please sign in to comment.