<?php

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

return new class extends Migration
{
    public function up()
    {
        Schema::table('confeccions', function (Blueprint $table) {
            if (! Schema::hasColumn('confeccions', 'descuentos_cobros')) {
                $table->decimal('descuentos_cobros', 12, 2)->default(0)->after('total_pagar');
            }
        });
    }

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