<?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
    {
        if (! Schema::hasColumn('items', 'free_delivery_badge_status')) {
            Schema::table('items', function (Blueprint $table) {
                $table->boolean('free_delivery_badge_status')->default(false)->after('item_packaging_charge');
            });
        }
    }

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