<?php

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

class CreateCurrencyRateLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('currency_rate_logs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('currency_rate_id')->unsigned();
            $table->decimal('selling', 20, 5);
            $table->foreignId('created_by')->unsigned();
            $table->timestamps();

            $table->foreign('currency_rate_id')->references('id')->on('currency_rates');
            $table->foreign('created_by')->references('id')->on('users');
        });
    }

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