求助,Laravel 创建数据库时 int 类型设置默认值
*create*_table.php中代码:$table->integer('ip', 10)->default(0);
migrate时错误提示:
[Illuminate\Database\QueryException]SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'ip' (SQL: create table***, `ip` int not null default '0' auto_increment primary key, ***
为什么会这样子。。。
为什么自动给加上了auto_increment primary key,而且还给0自动加上了单引号。。。
但是另一个字段$table->integer('view_count')->default(0);
没有问题。。。
integer不能限制长度?
推荐文章: