<?php

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

return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('mony_imports', function (Blueprint $table) {
            $table
                ->bigInteger('employee_id')
                ->unsigned()
                ->nullable()
                ->after('notes');
           
            $table
                ->foreign('employee_id')
                ->references('id')
                ->on('employees')
                ->onDelete('cascade')
                ->onUpdate('cascade');
            
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('mony_imports', function (Blueprint $table) {
            $table->dropColumn('employee_id');
           
            $table->dropForeign('mony_imports_employee_id_foreign');
        });
    }
};
