28 lines
797 B
PHP
28 lines
797 B
PHP
<?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('conversations', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->enum('type', ['direct', 'group'])->default('direct');
|
|
$table->string('title')->nullable();
|
|
$table->unsignedBigInteger('created_by');
|
|
$table->timestamp('last_message_at')->nullable()->index();
|
|
$table->timestamps();
|
|
|
|
$table->foreign('created_by')->references('id')->on('users')->onDelete('cascade');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('conversations');
|
|
}
|
|
};
|