<?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('projects', function (Blueprint $table): void {
            $table->id();
            $table->ulid('ulid')->unique();
            $table->foreignId('user_id')->constrained()->restrictOnDelete();
            $table->string('name', 150);
            $table->string('domain', 253);
            $table->string('url', 2048);
            $table->string('status', 20)->default('active')->index();
            $table->timestamp('archived_at')->nullable()->index();
            $table->timestamps();
            $table->unique(['user_id', 'domain']);
        });
    }
    public function down(): void { Schema::dropIfExists('projects'); }
};
