当我尝试在laravel中迁移此表。
命令输出是:
[PDOException] SQLSTATE [42000]:语法错误或访问冲突:1075表定义不正确;只能有一个自动列,必须将其定义为键
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->increments('id');
$table->bigInteger('post_author', 20);
$table->text('post_title');
$table->longText('post_content');
$table->string('post_status', 20);
$table->string('comment_status', 20);
$table->string('post_type', 20);
$table->timestamps();
$table->softDeletes();
});
}
不要为bigInteger列指定大小
$table->bigInteger('post_author');