<?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
    {
        // "union" is a SQL reserved word, so the column is named union_name.
        Schema::table('employees', function (Blueprint $table) {
            $table->string('union_name')->nullable()->after('marital_status');
        });

        Schema::table('payslips', function (Blueprint $table) {
            $table->string('union_name')->nullable()->after('pen_number');
        });
    }

    public function down(): void
    {
        Schema::table('employees', fn (Blueprint $table) => $table->dropColumn('union_name'));
        Schema::table('payslips', fn (Blueprint $table) => $table->dropColumn('union_name'));
    }
};
