<?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
    {
        $sql = <<<'SQL'
            CREATE TABLE request_quotations (
                id					               	BIGINT GENERATED always AS IDENTITY PRIMARY KEY,

                spot_rate_transport_master_id       BIGINT NOT NULL,
                rfq_number                          TEXT NOT NULL,
                rfq_date_time					    TIMESTAMP NOT NULL DEFAULT NOW(),
                pickup_address                      TEXT NOT NULL,
                delivery_address                    TEXT NOT NULL,
                weight                              TEXT NOT NULL,
                volumetrice_size_inch               TEXT NOT NULL,
                type_of_vehicle                     TEXT NOT NULL,
                special_type                        TEXT NOT NULL,
                no_of_vehicle                       TEXT NOT NULL,
                product_name                        TEXT NOT NULL,
                loading_by                          TEXT NOT NULL,
                unloading_by                        TEXT NOT NULL,
                pick_and_delivery                   TEXT NOT NULL,
                payment_term                        TEXT NOT NULL,
                paid_topay                          TEXT NOT NULL,
                require_date_time                   TIMESTAMP NOT NULL DEFAULT NOW(),
                rfq_rec_on_or_before                TIMESTAMP NOT NULL DEFAULT NOW(),
                transporter_name                    TEXT NULL,
                total_freight_charge                TEXT NULL,
                transit_day                         TEXT NULL,

                created_at							TIMESTAMP NOT NULL DEFAULT NOW(),
                updated_at							TIMESTAMP NOT NULL DEFAULT NOW(),
                created_by							TEXT DEFAULT NULL,
                updated_by							TEXT DEFAULT NULL,
                deleted_at			                TIMESTAMP,

                FOREIGN KEY (spot_rate_transport_master_id)  REFERENCES  spot_rate_transport_masters (id)

            );
        SQL;
        DB::statement($sql);
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('request_quotations');
    }
};
