Laravel 1075表定义不正确;只能有一个自动列,必须将其定义为键

问题描述 投票:0回答:1

当我尝试在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();
    });
}
php laravel laravel-5
1个回答
2
投票

不要为bigInteger列指定大小

$table->bigInteger('post_author');
© www.soinside.com 2019 - 2024. All rights reserved.