<?php

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

class AddIsSubColumnToSlidersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable('sliders') && !Schema::hasColumn('sliders', 'is_sub')) {
            Schema::table('sliders', function (Blueprint $table) {
                $table->boolean('is_sub')->default(false)->after('is_pop'); // Adjust `after` as needed
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if (Schema::hasTable('sliders') && !Schema::hasColumn('sliders', 'is_sub')) {
            Schema::table('sliders', function (Blueprint $table) {
                $table->boolean('is_sub')->default(false)->after('is_pop'); // Adjust `after` as needed
            });
        }
    }
}
