<?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
    {
        Schema::table('tender_entry', function (Blueprint $table) {

            // Column add
            $table->unsignedBigInteger('TnT_ID')->nullable()->after('Lg_Id');

            // Foreign key add
            $table->foreign('TnT_ID', 'fk_tnd_te')
                ->references('TnT_ID')
                ->on('tender_type')
                ->onUpdate('CASCADE')
                ->onDelete('RESTRICT');
        });
    }

    public function down(): void
    {
        Schema::table('tender_entry', function (Blueprint $table) {

            $table->dropForeign('fk_tnd_te');
            $table->dropColumn('TnT_ID');
        });
    }
};
