dealhub/database/migrations/2026_02_11_052318_create_messages_table.php

37 lines
975 B
PHP

<?php
use App\Models\Inbox;
use App\Models\User;
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('messages', function (Blueprint $table) {
$table->id()->index();
$table->foreignIdFor(User::class)->index();
$table->foreignIdFor(Inbox::class)->index();
$table->text('message');
$table->time('read_at')->nullable();
$table->time('delivered_at')->nullable();
$table->time('deleted_at')->nullable();
$table->time('failed_at')->nullable();
$table->timestamp('created_at')->useCurrent()->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('messages');
}
};