Initialer Laravel Commit für BetiX
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// ---------------------------------------------------------------
|
||||
// FRIENDS
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('friends', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('friend_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->enum('status', ['pending', 'accepted', 'blocked'])->default('pending');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'friend_id']);
|
||||
$table->index(['friend_id', 'status']);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PROFILE LIKES
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('profile_likes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete(); // The liker
|
||||
$table->foreignId('profile_id')->constrained('users')->cascadeOnDelete(); // The profile owner
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'profile_id']);
|
||||
$table->index('profile_id');
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PROFILE COMMENTS
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('profile_comments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete(); // The commenter
|
||||
$table->foreignId('profile_id')->constrained('users')->cascadeOnDelete(); // The profile owner
|
||||
$table->text('content');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['profile_id', 'created_at']);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PROFILE REPORTS
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('profile_reports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('reporter_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->foreignId('profile_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->string('reason');
|
||||
$table->text('details')->nullable();
|
||||
$table->json('snapshot')->nullable();
|
||||
$table->string('screenshot_path', 500)->nullable();
|
||||
$table->enum('status', ['pending', 'reviewed', 'dismissed'])->default('pending');
|
||||
$table->text('admin_note')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['profile_id', 'status']);
|
||||
$table->index('reporter_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('profile_reports');
|
||||
Schema::dropIfExists('profile_comments');
|
||||
Schema::dropIfExists('profile_likes');
|
||||
Schema::dropIfExists('friends');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user