<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('vendors', function (Blueprint $table) {
            $table->string('code', 50)->change();
            $table->string('name', 100)->change();
            $table->string('short_name', 50)->nullable()->change();
            $table->string('tax_id', 20)->nullable()->change();
            $table->string('owner', 50)->nullable()->change();
            $table->string('contact_name', 50)->nullable()->change();
            $table->string('tel', 20)->nullable()->change();
            $table->string('phone', 20)->nullable()->change();
        });

        Schema::table('products', function (Blueprint $table) {
            $table->string('code', 50)->change();
            $table->string('name', 100)->change();
            $table->string('brand', 50)->nullable()->change();
            $table->string('base_unit', 20)->change();
            $table->string('large_unit', 20)->nullable()->change();
            $table->string('purchase_unit', 20)->nullable()->change();
        });

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

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('vendors', function (Blueprint $table) {
            $table->string('code', 255)->change();
            $table->string('name', 255)->change();
            $table->string('short_name', 255)->nullable()->change();
            $table->string('tax_id', 255)->nullable()->change();
            $table->string('owner', 255)->nullable()->change();
            $table->string('contact_name', 255)->nullable()->change();
            $table->string('tel', 255)->nullable()->change();
            $table->string('phone', 255)->nullable()->change();
        });

        Schema::table('products', function (Blueprint $table) {
            $table->string('code', 255)->change();
            $table->string('name', 255)->change();
            $table->string('brand', 255)->nullable()->change();
            $table->string('base_unit', 255)->change();
            $table->string('large_unit', 255)->nullable()->change();
            $table->string('purchase_unit', 255)->nullable()->change();
        });

        Schema::table('categories', function (Blueprint $table) {
            $table->string('name', 255)->change();
        });
    }
};
