<?php

declare(strict_types=1);


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('links', function (Blueprint $table) {
            $table->id();
            $table->string('name', 100);
            $table->string('url', 255);
            $table->string('note', 255)->nullable();
            $table->tinyInteger('display_order')->default(0);
            $table->boolean('visible')->default(true);
            $table->timestamps();
        });

        Schema::create('settings', function (Blueprint $table) {
            $table->string('key')->primary();
            $table->text('value');
            $table->timestamps();
        });

        Schema::create('plugin_records', function (Blueprint $table) {
            $table->id();
            $table->string('vendor', 60);
            $table->string('name', 60);
            $table->string('version', 40)->nullable();
            $table->boolean('enabled')->default(true);
            $table->timestamps();

            $table->unique(['vendor', 'name']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('plugin_records');
        Schema::dropIfExists('settings');
        Schema::dropIfExists('links');
    }
};
