33 lines
750 B
PHP
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');
|
|
}
|
|
};
|