Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在当前 MySQL 表中有一列具有定义float(3,2),我需要将其扩展为float(4,2). 如何使用 Phinx (CakePHP) 迁移列规范执行此操作?
float(3,2)
float(4,2)
以下似乎可行,但在 Phinx 和 CakePHP 文档中均未记录。使用风险自负,并测试是否生成了正确的结果。键scale用于小数点右侧的数字和precision最大数字(宽度)。
scale
precision
public function up(): void { $this->table('my_table') ->changeColumn('my_column', 'float', ['scale' => 2, 'precision' => 4]) ->save(); }