<?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('user_statistics', function (Blueprint $table) {
            $table->unsignedBigInteger('user_id')->primary();

            $table->unsignedInteger('uploads')->default(0);
            $table->unsignedInteger('downloads')->default(0);
            $table->unsignedInteger('pageviews')->default(0);
            $table->unsignedInteger('awards')->default(0);

            $table->timestamps();

            $table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
        });
    }

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