Initial commit: Animexe Laravel platform
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?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('comments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->string('commentable_type'); // 'anime', 'episode'
|
||||
$table->unsignedBigInteger('commentable_id');
|
||||
$table->foreignId('parent_id')->nullable()->constrained('comments')->onDelete('cascade');
|
||||
$table->text('content');
|
||||
$table->enum('status', ['pending', 'approved', 'rejected', 'spam'])->default('approved');
|
||||
$table->boolean('is_pinned')->default(false);
|
||||
$table->integer('like_count')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['commentable_type', 'commentable_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('comments');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user