<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
    public function up(): void {Schema::table('messages',function(Blueprint $t){$t->string('provider_message_id')->nullable()->index();$t->timestamp('delivered_at')->nullable();$t->timestamp('read_at')->nullable();$t->timestamp('failed_at')->nullable();$t->json('provider_metadata')->nullable();$t->unique(['business_id','provider_message_id'],'messages_provider_unique');});}
    public function down(): void {Schema::table('messages',function(Blueprint $t){$t->dropUnique('messages_provider_unique');$t->dropColumn(['provider_message_id','delivered_at','read_at','failed_at','provider_metadata']);});}
};
