Files
L-Ami-Fiduciaire/database/migrations/2026_03_01_144730_create_messages_table.php

36 lines
957 B
PHP
Raw Normal View History

<?php
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();
$table->foreignId('folder_id')->constrained()->cascadeOnDelete();
$table->string('type'); // invite, situation, file_request, confirmation, text
$table->text('body');
$table->string('sent_by_type'); // user, client
$table->unsignedBigInteger('sent_by_id');
$table->json('metadata')->nullable();
$table->timestamps();
$table->index(['folder_id', 'created_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('messages');
}
};