Php Illumb\Database\QueryException:SQLSTATE[HY000]:一般错误:1364字段“id”没有默认值

Php Illumb\Database\QueryException:SQLSTATE[HY000]:一般错误:1364字段“id”没有默认值,php,laravel,Php,Laravel,我在从Laravel迁移中迁移表时遇到此错误 Schema::create('galleries', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('title'); $table->text('images'); $table->timestamps(); }); 我的终端出现的全部错误如下: I

我在从Laravel迁移中迁移表时遇到此错误

Schema::create('galleries', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->string('title');
        $table->text('images');
        $table->timestamps();
    });
我的终端出现的全部错误如下:

Illuminate\Database\QueryException  : SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value (SQL: insert into `migrations` (`migration`, `batch`) values (2019_11_10_143218_create_galleries_table, 2))

at /var/www/html/example.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
660|         // If an exception occurs when attempting to run a query, we'll format the error
661|         // message to include the bindings with SQL, which will make this exception a
662|         // lot more helpful to the developer instead of just the database's errors.
663|         catch (Exception $e) {

Exception trace:

1   PDOException::("SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value")
  /var/www/html/example.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458

2   PDOStatement::execute()
  /var/www/html/example.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458

Please use the argument -v to see more details.

您正在尝试在db中添加一行,但该行未传递id,并且在db表id中未设置为自动生成。

问题不在于迁移。该错误发生在尝试插入行时。也许你可以和我们分享laravel.log,还有更多的代码行。我只创建了一个简单的迁移并运行了“php artisan migrate”,其他什么都没有,我得到了Illumb\Database\QueryException:SQLSTATE[HY000]:一般错误:1364字段“id”没有默认值。你能提供完整的迁移代码吗?这里肯定还有其他原因,因为bigIncrements不需要默认值,因为它是自动递增的。我编辑了我的问题。实际错误是,迁移表“id”字段是自动递增的。我的手机关机了。我不知道怎么做。谢谢。我只创建了一个简单的迁移并运行了“php artisan migrate”,没有其他操作,我得到了Illumb\Database\QueryException:SQLSTATE[HY000]:一般错误:1364字段“id”没有默认值BigIncrements是自动递增的,不需要值。