<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddFksToPaymentMedicalService extends Migration
{
    public function up()
    {
        Schema::table('payment_medical_service', function (Blueprint $table) {
            $table->foreign('payment_id')
                ->references('id')
                ->on('payments')
                ->onDelete('cascade');
                
            $table->foreign('medical_service_id')
                ->references('id')
                ->on('medical_services')
                ->onDelete('cascade');
        });
    }

    public function down()
    {
        Schema::table('payment_medical_service', function (Blueprint $table) {
            $table->dropForeign(['payment_id']);
            $table->dropForeign(['medical_service_id']);
        });
    }
}
