<?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('legal_pages', function (Blueprint $table) {
            $table->id();
            $table->string('slug', 32);
            $table->json('title');
            $table->json('body_markdown');
            $table->string('locale_fallback', 5)->default('de');
            $table->integer('version')->default(1);
            $table->timestamp('effective_from')->nullable();
            $table->boolean('is_published')->default(false);
            $table->timestamps();
            $table->unique(['slug','version']);
        });
    }

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

