<?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('solicitor_phone_numbers', function (Blueprint $table) {
            // Remove the one-number-per-type constraint so a solicitor can have
            // multiple numbers of the same type (e.g. two client lines).
            $table->dropUnique(['solicitor_id', 'phone_number_type_id']);
        });
    }

    public function down(): void
    {
        Schema::table('solicitor_phone_numbers', function (Blueprint $table) {
            $table->unique(['solicitor_id', 'phone_number_type_id']);
        });
    }
};
