2025_12_04_000004_create_comments_table.php 698 B

123456789101112131415161718192021222324252627
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. public function up(): void
  8. {
  9. Schema::create('comments', function (Blueprint $table) {
  10. $table->id();
  11. $table->foreignId('submission_id')->constrained()->onDelete('cascade');
  12. $table->string('author', 100);
  13. $table->text('content');
  14. $table->timestamps();
  15. $table->softDeletes();
  16. $table->index('submission_id');
  17. });
  18. }
  19. public function down(): void
  20. {
  21. Schema::dropIfExists('comments');
  22. }
  23. };