【发布时间】:2021-07-21 08:57:51
【问题描述】:
在我的 Laravel-8 应用程序中,我得到了以下代码:
public function up()
{
Schema::create('user_log_activities', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('user_id')->nullable()->unsigned();
$table->string('log_url', 300)->nullable();
$table->string('log_method', 20)->nullable();
$table->string('log_type', 50)->nullable();
$table->string('subject', 200)->nullable();
$table->string('subject_hint', 20)->nullable();
$table->integer('company_id', 11)->nullable();
$table->string('id_address', 64)->nullable();
$table->string('agent', 300)->nullable();
$table->timestamps();
});
}
问题出在这里:
$table->bigInteger('user_id')->nullable()->unsigned();
user_id 不是自动递增的,但是我收到了这个错误:
PDOException::("SQLSTATE[42000]: 语法错误或访问冲突:1075 表定义不正确;只能有一个 auto 列,它必须被定义为一个键")
我尝试了几种方法,但都不起作用
如何解决?
谢谢
【问题讨论】:
标签: laravel