我使用迁移添加了新列。
这是我新添加的字段
$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'
]);