migrations
migrations copied to clipboard
migration_diff generates incorrect code for decimal column definition change
This is a (multiple allowed):
-
[x] 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,
])
Might this be fixed by https://github.com/cakephp/migrations/pull/571 ?
Also those seem related:
- https://github.com/cakephp/phinx/issues/1481
- https://github.com/cakephp/migrations/issues/314