<?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('items', function(Blueprint $table){
            $table->id();
            $table->string('nama');
            $table->string('sku')->nullable()->unique();
            $table->text('deskripsi')->nullable();
            $table->integer('jumlah')->default(0);
            $table->integer('min_stok')->default(1);
            $table->foreignId('divisi_id')->nullable()->constrained('divisis')->cascadeOnDelete();
            $table->string('image')->nullable();
            $table->timestamps();
        });
    }
    public function down(){ Schema::dropIfExists('items'); }
};
