Laravel 5.2 迁移中对列的迁移评论

Laravel 5.2 migration comment on column in migration

我正在用 laravel 5.2 开发一个项目。我有一个问题,我创建了一个迁移文件来更改列的评论。但是根据文档,它说 "column modifiers" 在添加列时使用。所以我不知道如何更新现有专栏的评论,有人可以帮助我吗?谢谢

您可以将 comment() 方法与 change()

一起使用
Schema::table('users', function(Blueprint $table) {
    $table->string('name')->comment('Name of the user')->change();
});

确保它正确迁移

mysql> show full columns from users like 'name';
+-------+--------------+--------------------+------+-----+---------+-------+---------------------------------+------------------+
| Field | Type         | Collation          | Null | Key | Default | Extra | Privileges                      | Comment          |
+-------+--------------+--------------------+------+-----+---------+-------+---------------------------------+------------------+
| name  | varchar(255) | utf8mb4_unicode_ci | NO   |     | NULL    |       | select,insert,update,references | Name of the user |
+-------+--------------+--------------------+------+-----+---------+-------+---------------------------------+------------------+