<?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('bio_blocks', function (Blueprint $table) {
            $table->id();
            $table->foreignId('bio_page_id')->constrained()->cascadeOnDelete();
            $table->unsignedSmallInteger('position')->default(0);
            $table->string('type', 32);
            $table->json('config');
            $table->timestamps();
            $table->index(['bio_page_id', 'position']);
        });
    }

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