<?php

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

return new class extends Migration
{
    private const DESFILE_TENANT_CODE = 'desfile_pura_tendencia';

    public function up(): void
    {
        Schema::table('tenants', function (Blueprint $table): void {
            $table->boolean('scanner_category_validation_enabled')
                ->default(true)
                ->after('display_cart');
        });

        DB::table('tenants')
            ->where('codigo', self::DESFILE_TENANT_CODE)
            ->update(['scanner_category_validation_enabled' => false]);
    }

    public function down(): void
    {
        Schema::table('tenants', function (Blueprint $table): void {
            $table->dropColumn('scanner_category_validation_enabled');
        });
    }
};
