CakePHP迁移重新组织列顺序



我使用迁移添加了新列。

这是我新添加的字段

$table->addColumn('lastname', 'string', [
'default' => null,
'limit' => 255,
'null' => false,
]);

此列添加在modified字段之后。我想更改列顺序,并将其放在name列之后。我如何使用迁移做到这一点?

您可以在option中使用after,在添加时间时

$table->addColumn('firstname', 'string', [
'default' => null,
'limit' => 255,
'null' => false,
'after' => 'name'
]);

最新更新