<?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('pay', function (Blueprint $table) {
            $table->unsignedBigInteger('pay_type_id')->nullable()->after('id');
            $table->foreign('pay_type_id')->references('id')->on('pay_type')->onDelete('set null');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('pay', function (Blueprint $table) {
            $table->dropForeign(['pay_type_id']);
            $table->dropColumn('pay_type_id');
        });
    }
};
