Simplifies user_follows Table Columns

The column and FK can be defined together using the `foreignId` method.
This commit is contained in:
Refringe 2024-09-17 15:26:30 -04:00
parent 09e9e15c5e
commit 7c4753d38e
Signed by: Refringe
SSH Key Fingerprint: SHA256:t865XsQpfTeqPRBMN2G6+N8wlDjkgUCZF3WGW6O9N/k

View File

@ -13,10 +13,8 @@ return new class extends Migration
{
Schema::create('user_follows', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('follower_id');
$table->unsignedBigInteger('following_id');
$table->foreign('follower_id')->references('id')->on('users')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('following_id')->references('id')->on('users')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('follower_id')->references('id')->on('users')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('following_id')->references('id')->on('users')->cascadeOnDelete()->cascadeOnUpdate();
$table->timestamps();
});
}