<?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('coupons_usage', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('coupon_id')->index();
            $table->bigInteger('used_by')->index();
            $table->date('expiration_date');
            $table->decimal('amount', 10, 2)->nullable();
            $table->double('monthly_percentage', 10, 2)->nullable();
            $table->double('yearly_percentage', 10, 2)->nullable();
            $table->timestamps();
        });
    }

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