feat: add community activity feed and mentions

This commit is contained in:
2026-03-17 18:26:57 +01:00
parent 2728644477
commit 2119741ba7
15 changed files with 1280 additions and 112 deletions

View File

@@ -0,0 +1,34 @@
<?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
{
Schema::create('user_mentions', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('mentioned_user_id');
$table->unsignedBigInteger('artwork_id')->nullable();
$table->unsignedBigInteger('comment_id');
$table->timestamp('created_at')->useCurrent();
$table->unique(['comment_id', 'mentioned_user_id'], 'user_mentions_comment_user_unique');
$table->index(['mentioned_user_id', 'created_at'], 'user_mentions_mentioned_created_idx');
$table->index(['user_id', 'created_at'], 'user_mentions_actor_created_idx');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('mentioned_user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('artwork_id')->references('id')->on('artworks')->onDelete('cascade');
$table->foreign('comment_id')->references('id')->on('artwork_comments')->onDelete('cascade');
});
}
public function down(): void
{
Schema::dropIfExists('user_mentions');
}
};