<?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
    {
        // Increase name length in price_settings to 50
        Schema::table('price_settings', function (Blueprint $table) {
            $table->string('name', 50)->change();
        });

        // Increase nama_produk in stok_akhir to 50
        Schema::table('stok_akhir', function (Blueprint $table) {
            $table->string('nama_produk', 50)->nullable()->change();
        });

        // Increase nama_produk in belanja to 50
        Schema::table('belanja', function (Blueprint $table) {
            $table->string('nama_produk', 50)->change();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('price_settings', function (Blueprint $table) {
            $table->string('name', 20)->change();
        });

        Schema::table('stok_akhir', function (Blueprint $table) {
            $table->string('nama_produk', 20)->nullable()->change();
        });

        Schema::table('belanja', function (Blueprint $table) {
            $table->string('nama_produk', 20)->change();
        });
    }
};
