feat: add reciprocal user blocking
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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_blocks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignUlid('blocker_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->foreignUlid('blocked_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['blocker_id', 'blocked_id']);
|
||||
$table->index(['blocked_id', 'blocker_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_blocks');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user