Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration_diff generates incorrect code for decimal column definition change #659

Open
1 task done
thonhaus opened this issue Nov 10, 2023 · 2 comments
Open
1 task done

Comments

@thonhaus
Copy link
Contributor

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,
])
@dereuromark
Copy link
Member

Might this be fixed by #571 ?

@dereuromark
Copy link
Member

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

No branches or pull requests

2 participants