Skip to content

Fix Decimal Column Definition Issue When Scale is 0#2377

Merged
dereuromark merged 1 commit intocakephp:0.xfrom
runphp:patch-1
Oct 22, 2025
Merged

Fix Decimal Column Definition Issue When Scale is 0#2377
dereuromark merged 1 commit intocakephp:0.xfrom
runphp:patch-1

Conversation

@runphp
Copy link
Contributor

@runphp runphp commented Oct 22, 2025

In CakePHP's MySQL adapter, when defining a Decimal column with scale set to 0 (e.g. DECIMAL(65,0) or DECIMAL(10,0)), the generated SQL definition was missing precision information.
Specifically, when users need to create a DECIMAL(65) column (precision=65, scale=0), due to the condition check $column->getScale() returning 0, which is treated as false in boolean context, the entire condition $column->getPrecision() && $column->getScale() evaluates to false, causing the precision and scale definition to be skipped.

In CakePHP's MySQL adapter, when defining a Decimal column with scale set to 0 (e.g. DECIMAL(65,0) or DECIMAL(10,0)), the generated SQL definition was missing precision information.
Specifically, when users need to create a DECIMAL(65) column (precision=65, scale=0), due to the condition check $column->getScale() returning 0, which is treated as false in boolean context, the entire condition $column->getPrecision() && $column->getScale() evaluates to false, causing the precision and scale definition to be skipped.
@dereuromark dereuromark merged commit c9f214d into cakephp:0.x Oct 22, 2025
11 of 12 checks passed
@runphp runphp deleted the patch-1 branch October 22, 2025 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants