如何修改mysql表的字段类型
通过命令创建migration文件
内容如下
```
integer('admin_id')->after('id')->comment('admin_id');
DB::statement("ALTER TABLE user_list MODIFY mobile int default 0 NOT NULL");
$table->renamecolumn('mobile','user_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('user_list', function(Blueprint $table)
{
$table->dropColumn('admin_id');
DB::statement("ALTER TABLE hl_user_list MODIFY user_id varchar(20) default '' NOT NULL COMMENT '手机号'");
$table->renameColumn('user_id','mobile');
});
}
}
```
执行php artisan migrate即可完成字段的类型修改