So instead of "bigInteger()", you can use "unsignedBigInteger()" or "bigInteger()->unsigned()".
Schema::create('posts', function (Blueprint $table) { $table->unsignedBigInteger('user_id')->index(); $table->foreign('user_id') ->references('id') ->on('users'); });
On the user table, it will be like the usual definition,
Schema::create('users', function (Blueprint $table) { $table->id(); });
Do note the when inspecting the"id()" helper the content is just "bigIncrements()" so don't get confused by it.
return $this->bigIncrements($column);
Leave a reply