<?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
    {
        Schema::create('views', function (Blueprint $table) {
            $table->id();
            $table->date('fecha')->unique(); // Permite registrar y buscar por fecha (YYYY-MM-DD)
            $table->unsignedBigInteger('total_visitas')->default(0);
            $table->unsignedBigInteger('total_clicks')->default(0);
            $table->float('public_rebote')->default(0); // Cambiado a float para soportar decimales
            $table->float('public_retention')->default(0); // Cambiado a float para soportar decimales
            $table->timestamps();
        });
    }

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