<?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::create('items_consumables', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('item_id')->index();
            $table->unsignedBigInteger('consumable_item_id')->index();
            $table->unsignedInteger('quantity')->default(1);
            $table->timestamps();

            $table->unique(['item_id', 'consumable_item_id']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('items_consumables');
    }
};
