<?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('cutting_materials', function (Blueprint $table): void {
            $table->foreignId('combination_id')->nullable()->after('raw_material_price_id')->constrained('cutting_material_combinations')->cascadeOnDelete();
        });
    }

    public function down(): void
    {
        Schema::table('cutting_materials', function (Blueprint $table): void {
            $table->dropConstrainedForeignId('combination_id');
        });
    }
};
