<?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::table('koleksis', function (Blueprint $table) {
            if (!Schema::hasColumn('koleksis', 'barcode')) {
                $table->string('barcode')->nullable()->after('label')->comment('Path file barcode PNG');
            }
        });
    }

    public function down(): void
    {
        Schema::table('koleksis', function (Blueprint $table) {
            if (Schema::hasColumn('koleksis', 'barcode')) {
                $table->dropColumn('barcode');
            }
        });
    }
};

