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

33 lines
750 B
PHP

<?php
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('inboxes', function (Blueprint $table) {
$table->id()->index();
$table->text('last_message')->nullable();
$table->foreignIdFor(User::class, 'last_user_id')->nullable();
$table->timestamps();
$table->index(['last_user_id', 'created_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('inboxes');
}
};