<?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('product_print_stocks', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('product_id');
            $table->unsignedBigInteger('print_stock_id');
            $table->timestamps();
            
            $table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
            $table->foreign('print_stock_id')->references('id')->on('print_stocks')->onDelete('cascade');
            $table->unique(['product_id', 'print_stock_id']);
        });
    }

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