<?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('categories', function (Blueprint $table) {
            $table->id();
            $table->string('campaign_id')->default('GoPoints'); // Identificador de campaña
            $table->string('code')->unique();                   // ID de la categoría (Jumpseller)
            $table->string('name');                             // Nombre de la categoría
            $table->foreignId('parent_id')->nullable()->constrained('categories'); // Categoría padre
            $table->timestamps();
        });
    }

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