<?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_images', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('produk_id');
            $table->string('foto');
            $table->boolean('is_primary')->default(false);
            $table->timestamps();
            
            $table->index('produk_id');
        });
    }
    
    public function down(): void
    {
        Schema::dropIfExists('product_images');
    }
};