2017-06-15 135 views
0

我正在用laravel 5.2开发一个项目。我有一个问题,我创建了一个迁移文件来改变列的评论。但根据文档,它说当你添加一列时使用“列修饰符”。所以我不知道如何更新现有专栏的评论,有人可以帮助我?谢谢。Laravel 5.2迁移评论移植专栏

回答

1

您可以使用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 | 
+-------+--------------+--------------------+------+-----+---------+-------+---------------------------------+------------------+ 
+0

谢谢您的回答。 – pppwwwa