<?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('display_cart_item_images')->default(true)->after('cart_editing_enabled');
        });

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

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