<?php

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

class AddStockSyncedToTailoringProductsTable extends Migration
{
    public function up()
    {
        if (Schema::hasTable('tailoring_products') && !Schema::hasColumn('tailoring_products', 'stock_synced')) {
            Schema::table('tailoring_products', function (Blueprint $table) {
                $table->boolean('stock_synced')->default(false)->after('is_active');
            });
        }
    }

    public function down()
    {
        if (Schema::hasTable('tailoring_products') && Schema::hasColumn('tailoring_products', 'stock_synced')) {
            Schema::table('tailoring_products', function (Blueprint $table) {
                $table->dropColumn('stock_synced');
            });
        }
    }
}
