【发布时间】:2015-04-05 22:55:56
【问题描述】:
我在 Laravel 中迁移时不断出错
[PDO异常] SQLSTATE[42000]:语法错误或访问冲突:1075 表定义不正确;只能有一个自动列,并且必须定义 作为钥匙
代码
public function up()
{
Schema::create('inventories', function($table){
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->string('sku',255);
$table->string('description', 255 )->nullable;
$table->tinyInteger('stock',5)->nullable()->unsigned();
$table->tinyInteger('day_of_week',1)->unsigned();
$table->text('note')->nullable();
$table->timestamps();
});
}
【问题讨论】:
-
您不必致电
unsigned()。increments()已经这样做了。但是我怀疑这会导致错误... -
感谢您的提示。 :D
标签: laravel laravel-4 migration