【发布时间】:2016-10-08 18:06:44
【问题描述】:
这是我的代码:
public function up()
{
Schema::create('sysmods', function (Blueprint $table) {
$table->increments('mod_id');
$table->string('mod_name','60');
$table->string('mod_alias_name','60');
$table->integer('mod_tb_id','6');// this will become auto increment?
$table->timestamps();
});
}
当我运行 migrate 命令时,它说: " [PDO异常] SQLSTATE [42000]:语法错误或访问冲突:1075 表定义不正确 启动;只能有一个自动列,并且必须将其定义为键”
然后,当我检查 sql 时,我发现了这个:
(SQL: 创建表la_sysmods (mod_id int unsigned not null auto_increm
ent 主键,mod_namevarchar(60) 不为空,mod_alias_namevarchar(
60) not null, mod_tb_id int not null auto_increment 主键, created
_at timestamp null, updated_at timestamp null) 默认字符集 utf
8 整理 utf8_unicode_ci)
标记为整数的字段“mod_tb_id”已变为增量。有什么问题?谢谢!
【问题讨论】:
标签: laravel