<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('company_ratings', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('company_id')->index()->comment = 'rated company';
            $table->bigInteger('loan_approved_history_id')->index()->comment = 'Borrow Approved id = Loan Approved id';
            $table->bigInteger('rated_by');
            $table->enum('rate', [1, 2, 3, 4, 5]);
            $table->enum('type', ['borrowing', 'loaning', 'others']);
            $table->longText('message')->nullable();
            $table->timestamps();
        });
    }

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