Skip to content

Migration generator not add precision and scale params for decimal column type in Embeddable class 🐛  #102

@ncodealex

Description

@ncodealex

No duplicates 🥲.

  • I have searched for a similar issue in our bug tracker and didn't find any solutions.

What happened?

Hello ! Thanks for your product !

I'm create embeddable class for my base entity.

#[Embeddable(columnPrefix: 'property_')]
final class ProductProperty
{
    #[Column(type: 'decimal', nullable: false, default: 0, precision: 2, scale: 10)]
    private int $width = 0;
    
    // and others columns

}

When i generate migration file with the command:

php app.php cycle:migrate

I get such a file that does not include params precision and scale params:

// Parent entity 
final class Product
{
    #[Column(type: 'decimal', nullable: true, precision: 2, scale: 2)]
    private int $minStock = 0;

    #[Embedded(target: 'ProductProperty')]
    private ProductProperty $property;
    
    public function __construct(){
        $this->property = new ProductProperty();
    }
}

// Generated migration for 'Product'

class OrmDefault503ad0138adb712888e44c220d4cf5aa extends Migration
{

    public function up(): void
    {
        $this->table('product')
->addColumn('min_stock', 'decimal', ['nullable' => true, 'defaultValue' => null, 'precision' => 2, 'scale' => 2]); /// This property in base entity
->addColumn('property_width', 'decimal', ['nullable' => false, 'defaultValue' => 0, 'precision' => 0, 'scale' => 0]) // And this in Embedded entity 
     }

}

I will be grateful for your help!

Version

annotated v4.1.0, orm v2.8.1, PHP 8.3

ORM Schema

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions