<?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('produk_varians', function (Blueprint $table) {
            $table->id();
            $table->foreignId('produk_id')
                  ->constrained('produks')
                  ->onDelete('cascade');
            $table->string('ukuran');        // misal: S, M, L, XL
            $table->string('warna');         // misal: Merah, Biru
            $table->decimal('harga', 12, 2); // harga spesifik varian
            $table->integer('stok')->default(0);
            $table->string('sku')->nullable(); // opsional
            $table->timestamps();
        });
    }

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