Skip to content

migration_diff generates incorrect code for decimal column definition change #659

Open
@thonhaus

Description

@thonhaus

This is a (multiple allowed):

  • bug

  • CakePHP Version: 4.4.16

  • Migrations plugin version: 3.9.0

  • Bake plugin version (if relevant): 2.9.3

  • Database server (MySQL, SQLite, Postgres): MariaDB

I have a MariaDB with a table containing a decimal column (e.g., defined as DECIMAL(4,2)). A migration snapshot was taken of this. If the definition is then changed (e.g., to DECIMAL(6,2)) and a migration diff is created, this leads to incorrect code.

The resulting code is

$this->table('mytable')
    ->changeColumn('mycolumn', 'decimal', [
        'default' => null,
        'limit' => 6,
        'null' => true,
])

and should be

$this->table('mytable')
    ->changeColumn('mycolumn', 'decimal', [
        'default' => null,
        'precision' => 6,
        'scale' => 2,
        'null' => true,
])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions