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'); } };