<?php

use App\Models\LocalizationManagement\Country;
use App\Models\OrderManagement\ShippingCompany;
use App\Models\OrderManagement\ShippingCompanyHasCountry;
use Illuminate\Database\Migrations\Migration;
use App\Helpers\DatabaseSchema\Schema;
use App\Helpers\DatabaseSchema\CustomBluePrint as Blueprint;


return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up(){
        Schema::create((new ShippingCompanyHasCountry)->getTable(), function (Blueprint $table) {
            $table->id();

            $table->foreignIdFor(Country::class,'country_id')
                ->constrained((new Country)->getTable(), (new Country)->getKeyName(),uniqid("FQ_"))
                ->cascadeOnUpdate()->cascadeOnDelete()
                ->comment("[FK]");

            $table->foreignIdFor(ShippingCompany::class,'shipping_company_id')
                ->constrained((new ShippingCompany)->getTable(), (new ShippingCompany)->getKeyName(),uniqid("FQ_"))
                ->cascadeOnUpdate()->cascadeOnDelete()
                ->comment("[FK]");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down(){
        Schema::dropIfExists((new ShippingCompanyHasCountry)->getTable());
    }
};
