<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('serah_terima_barangs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('serah_terima_id')->constrained()->cascadeOnDelete();
            $table->foreignId('inventaris_id')->nullable()->constrained()->nullOnDelete();
            $table->string('kode_barang');
            $table->string('nama_barang');
            $table->string('merk')->nullable();
            $table->string('tahun')->nullable();
            $table->string('asal_usul')->nullable();
            $table->string('satuan');
            $table->string('kepemilikan')->nullable();
            $table->integer('jumlah');
            $table->text('keterangan')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('serah_terima_barangs');
    }
};
