<?php

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

    class UpdatePersetujuanPenawaranTable extends Migration
    {
        /**
         * Run the migrations.
         *
         * @return void
         */
        public function up()
        {
            Schema::table('persetujuan_penawaran', function (Blueprint $table) {
                // Drop the existing attachment column
                $table->dropForeign(['region_id']);
                $table->dropColumn('attachment');

                // Add new columns for file attachments
                $table->string('file_persetujuan_penawaran')->nullable();
                $table->string('surat_representasi')->nullable();
                $table->string('bukti_bayar')->nullable();
            });
        }

        /**
         * Reverse the migrations.
         *
         * @return void
         */
        public function down()
        {
            Schema::table('persetujuan_penawaran', function (Blueprint $table) {
                // Reverse the changes
                $table->string('attachment')->nullable();

                $table->dropColumn('file_persetujuan_penawaran');
                $table->dropColumn('surat_representasi');
                $table->dropColumn('bukti_bayar');
            });
        }
    }
