<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up()
    {
        Schema::create('pesanan_detail', function (Blueprint $table) {
            $table->id();
            $table->foreignId('pesanan_id')
                  ->constrained('pesanan')
                  ->cascadeOnDelete();

            $table->foreignId('produk_id')
                  ->constrained('produk')
                  ->cascadeOnDelete();

            $table->string('nama_produk');
            $table->integer('harga');
            $table->integer('qty');
            $table->integer('subtotal');
            $table->string('warna')->nullable(); 
            $table->string('ukuran')->nullable();
            $table->timestamps();
        });
    }

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