<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
 * Adds dedicated-server stock tracking to the servers table.
 *
 * NULL = unlimited (paylaşımlı sunucu, kapasite `maximum_hosts` ile yönetilir).
 * Integer >= 0 = kalan dedike adet. 0 olunca yeni sipariş bu sunucuya yerleşmez.
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('servers', function (Blueprint $table) {
            $table->unsignedInteger('stock')->nullable()->after('maximum_hosts');
        });
    }

    public function down(): void
    {
        Schema::table('servers', function (Blueprint $table) {
            $table->dropColumn('stock');
        });
    }
};
