<?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('elements', function (Blueprint $table) {
            $table->id();
            $table->foreignId('set_id')->constrained('sets');
            $table->string('title');
            $table->foreignId('parent_element_id')
                ->nullable()
                ->constrained('elements');
        });
    }

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