Files
speedBB/database/migrations/2025_12_26_161913_create_threads_table.php
2025-12-29 18:19:24 +01:00

32 lines
779 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('threads', function (Blueprint $table) {
$table->id();
$table->foreignId('forum_id')->constrained('forums')->cascadeOnDelete();
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
$table->string('title');
$table->text('body');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('threads');
}
};