messages implemented

This commit is contained in:
2026-02-26 21:12:32 +01:00
parent d0aefc5ddc
commit 15b7b77d20
168 changed files with 14728 additions and 6786 deletions

View File

@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Allowed reaction slugs emoji mapping (authoritative list lives in ReactionType).
* Stored as VARCHAR to avoid MySQL ENUM emoji encoding issues.
*/
public function up(): void
{
Schema::create('artwork_reactions', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('artwork_id');
$table->unsignedBigInteger('user_id');
// slug: thumbs_up | heart | fire | laugh | clap | wow
$table->string('reaction', 20);
$table->timestamp('created_at')->useCurrent();
$table->unique(['artwork_id', 'user_id', 'reaction'], 'artwork_reactions_unique');
$table->index('artwork_id');
$table->index('user_id');
$table->foreign('artwork_id')->references('id')->on('artworks')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
Schema::create('comment_reactions', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('comment_id');
$table->unsignedBigInteger('user_id');
// slug: thumbs_up | heart | fire | laugh | clap | wow
$table->string('reaction', 20);
$table->timestamp('created_at')->useCurrent();
$table->unique(['comment_id', 'user_id', 'reaction'], 'comment_reactions_unique');
$table->index('comment_id');
$table->index('user_id');
$table->foreign('comment_id')->references('id')->on('artwork_comments')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}
public function down(): void
{
Schema::dropIfExists('comment_reactions');
Schema::dropIfExists('artwork_reactions');
}
};