dealhub/database/migrations/2026_02_11_052318_create_messages_table.php
kusowl 587893511c wip: live support chat
- add migration
- setup models
- generate phpdoc via helper
2026-02-11 12:27:58 +05:30

37 lines
970 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->time('created_at')->useCurrent()->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('messages');
}
};