<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('planes_items', function (Blueprint $table) {
            $table->string('codigo_componente', 150)->nullable()->change();
            $table->string('cambio_lubricacion', 200)->nullable()->change();
        });

        Schema::table('componentes', function (Blueprint $table) {
            $table->string('codigo', 100)->change();
            $table->string('unidad', 50)->nullable()->change();
        });

        Schema::table('equipos', function (Blueprint $table) {
            $table->string('codigo', 100)->change();
        });

        Schema::table('unidades', function (Blueprint $table) {
            $table->string('codigo', 50)->change();
        });

        Schema::table('frecuencias', function (Blueprint $table) {
            $table->string('codigo', 60)->change();
        });

        Schema::table('areas', function (Blueprint $table) {
            $table->string('codigo', 60)->change();
        });
    }

    public function down(): void
    {
        Schema::table('planes_items', function (Blueprint $table) {
            $table->string('codigo_componente', 40)->nullable()->change();
            $table->string('cambio_lubricacion', 100)->nullable()->change();
        });
        Schema::table('componentes', function (Blueprint $table) {
            $table->string('codigo', 40)->change();
            $table->string('unidad', 30)->nullable()->change();
        });
        Schema::table('equipos', function (Blueprint $table) {
            $table->string('codigo', 40)->change();
        });
        Schema::table('unidades', function (Blueprint $table) {
            $table->string('codigo', 20)->change();
        });
        Schema::table('frecuencias', function (Blueprint $table) {
            $table->string('codigo', 20)->change();
        });
        Schema::table('areas', function (Blueprint $table) {
            $table->string('codigo', 20)->change();
        });
    }
};
