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

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