<?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::table('solicitor_phone_numbers', function (Blueprint $table) {
            // The TwiML App SID drives the browser dialler's outgoing call
            // routing (VoiceGrant::setOutgoingApplicationSid). Storing it per
            // number lets each solicitor/subaccount use its own TwiML app
            // instead of the single system-wide TWILIO_TWIML_APP_SID env value.
            $table->string('twilio_twiml_app_sid')
                ->nullable()
                ->after('twilio_phone_number_sid');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('solicitor_phone_numbers', function (Blueprint $table) {
            $table->dropColumn('twilio_twiml_app_sid');
        });
    }
};
