<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('exchange_rates', function (Blueprint $table) {
            $table->id();
            $table->string('base', 3);
            $table->string('quote', 3);
            $table->decimal('rate', 18, 10);
            $table->timestamp('as_of')->nullable();
            $table->timestamp('updated_at')->nullable();

            $table->unique(['base', 'quote']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('exchange_rates');
    }
};

