It seems recent code uses foreignId when setting the column data type for many and polymorphic relationship foreign keys. However, the standard belongsTo relationship still uses unsignedBigInteger as the data type. For consistency within Blueprint and to align with whatever data type Laravel uses for "id" columns foreignId is now used.
Given the following draft file:
models:
Post:
author_id: id
Before:
Schema::create('posts', function (Blueprint $table) {
$table->unsignedBigInteger('author_id');
}
After:
Schema::create('posts', function (Blueprint $table) {
$table->foreignId('author_id');
}
It seems recent code uses
foreignId
when setting the column data type for many and polymorphic relationship foreign keys. However, the standardbelongsTo
relationship still usesunsignedBigInteger
as the data type. For consistency within Blueprint and to align with whatever data type Laravel uses for "id" columnsforeignId
is now used.Given the following draft file:
Before:
After: