[英]How to set length for enum type in migration Laravel 5
我有一个 MySQL 迁移:
class MakeEventsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('events', function (Blueprint $table) {
$table->increments('id');
$table->enum('type', ['sync', 'start_event', 'end_end', 'start_meeting_session', 'last_track_time'])->;
$table->timestamp('created_at');
});
}
}
结果,我有一个错误:
SQLSTATE[01000]:警告:1265 数据被截断为第 1 行的列“类型”(SQL:插入
events
(item_id
、item_type
、type
、created_at
)值(45、会议、last_track_time、2018-02-14 06:52: 10))
这是因为字段类型太小,我正在寻找解决方案,如何增加字段的长度?
更改相同并尝试这种方式...希望它会起作用。
$table->enum('event_info', ['sync', 'start_event', 'end_end', 'start_meeting_session', 'last_track_time']);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.