Files
fluent-chat/database/migrations/2026_04_30_203950_create_conversations_table.php
2026-05-01 00:42:01 +03:30

34 lines
858 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('conversations', function (Blueprint $table) {
$table->id();
$table->foreignId('created_by_id')->nullable()->constrained('users')->nullOnDelete();
$table->string('type')->default('direct')->index();
$table->string('name')->nullable();
$table->text('description')->nullable();
$table->timestamps();
$table->index(['type', 'updated_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('conversations');
}
};