【问题标题】:Php artisan migrate - syntax error, unexpected ' ' (T string )Php artisan migrate - 语法错误,意外''(T字符串)
【发布时间】:2020-06-26 01:38:44
【问题描述】:

迁移文件代码的代码。语法错误。

Schema::create('subjects', function (Blueprint $table) {$table->bigIncrements('id');
     $table->bigIncrements('id');
     $table->string('title')->nullable();
     $table->integer('order_id')->default('0');
     $table->unsignedBigInteger('test_type_id');
     $table->foreign('test_type_id')->references('id')->on('test_types');
     $table->enum('status',['active','deactive','draft'])->default('draft');
     $table->timestamps();
});

已经运行作曲家更新。让我知道我缺少什么。

如果问题重复,我很乐意将其删除。

【问题讨论】:

  • 删除一个$table->bigIncrements('id')
  • default('0'); => 默认(0);

标签: php laravel-6 laravel-migrations


【解决方案1】:

将此添加到迁移文件中,然后重试 只需删除一次“bigIncrements”即可。

 Schema::create('subjects', function (Blueprint $table) {
 $table->bigIncrements('id');
 $table->string('title')->nullable();
 $table->integer('order_id')->default(0);
 $table->unsignedBigInteger('test_type_id');
 $table->foreign('test_type_id')->references('id')->on('test_types');
 $table->enum('status',['active','deactive','draft'])->default('draft');
 $table->timestamps();
});

【讨论】:

  • default('0'); => 默认(0);正如@Ronak Dhoot 所说
猜你喜欢
  • 1970-01-01
  • 2020-10-23
  • 1970-01-01
  • 2020-11-27
  • 2016-05-14
  • 1970-01-01
  • 2018-08-04
  • 2018-11-18
  • 2016-10-14
相关资源
最近更新 更多