forge/database/migrations/2024_08_28_141058_user_follows.php

32 lines
879 B
PHP
Raw Normal View History

2024-08-28 16:59:28 -04:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
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->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('user_follows');
}
};