<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('company_location_customer', function (Blueprint $table) {
            $table->unsignedBigInteger('company_location_id');
            $table->unsignedBigInteger('customer_id');

            $table->foreign('company_location_id')
                ->references('id')->on('company_locations')
                ->onDelete('CASCADE')->onUpdate('CASCADE');
            $table->foreign('customer_id')
                ->references('id')->on('customers')
                ->onDelete('CASCADE')->onUpdate('CASCADE');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('company_location_customer');
    }
};
