# Migration Guide: 9.10.2 → 9.11.0

Osumi Framework **9.11.0** adds native ORM support for SQL `DECIMAL(p,s)` columns.

The update is backward compatible and existing model definitions do not require changes.

## DECIMAL Support

`DECIMAL` fields use `OField::DECIMAL` and PHP `?string` properties.

```php
#[OField(
	type: OField::DECIMAL,
	precision: 12,
	scale: 2,
	nullable: false
)]
public ?string $amount = null;
```

Using `string` prevents intermediate floating-point conversions and preserves the exact decimal value.

`float` and `int` values are not valid for `DECIMAL` fields.

The default precision is `10` and the default scale is `2`. The maximum supported precision is `65` and the maximum scale is `30`.

Both `.` and `,` are accepted as input decimal separators. The ORM always normalizes values to `.` and fixed scale:

```text
"12"   → "12.00"
"12.5" → "12.50"
"12,5" → "12.50"
```

The ORM never performs automatic rounding. Values exceeding the configured precision or scale are rejected.

`OField::DECIMAL` cannot be used in `#[OPK]` fields.

## Queries

Conditions passed to `where()` and `count()` are now validated and normalized according to the model schema.

For example, for a `DECIMAL(12,2)` field:

```php
Payment::where([
	'amount' => '12,5'
]);
```

internally uses `"12.50"`.

A floating-point value for the same field is rejected:

```php
Payment::where([
	'amount' => 12.5
]);
```

Conditions referencing fields that do not exist in the model are also rejected.

## Generators

`generateModel`, `generateModelFrom` and `generateModelFromDB` support `DECIMAL` fields.

`generateModelFromDB` preserves decimal precision, scale and default values as exact strings.

## PHP 8.5 Compatibility

ORM schema initialization now checks `ReflectionProperty::hasDefaultValue()` before calling `ReflectionProperty::getDefaultValue()`, avoiding the PHP 8.5 deprecation notice for properties without an explicit default value.

## Migration

There is no automatic migration step for this release.

Existing projects that do not use `OField::DECIMAL` do not need to modify their models.

Applications adopting `DECIMAL` should represent these values as exact strings and avoid converting them to `float`.
