<?php

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

return new class extends Migration
{
    public function up()
    {
        Schema::table('tender_entry', function (Blueprint $table) {

            // Rename column
            $table->renameColumn('Tnd_Date', 'TE_St_Date');

            // Add new columns
            $table->date('TE_Ed_Date')->nullable()->after('TE_St_Date');
            $table->string('BG_Per')->nullable()->after('TE_Ed_Date');
            $table->string('EMD_Per')->nullable()->after('BG_Per');
            $table->decimal('TE_Fee', 15, 2)->nullable()->after('EMD_Per');
        });
    }

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

            // Rename back
            $table->renameColumn('TE_St_Date', 'Tnd_Date');

            // Drop added columns
            $table->dropColumn([
                'TE_Ed_Date',
                'BG_Per',
                'EMD_Per',
                'TE_Fee'
            ]);
        });
    }
};
