<?php

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

/**
 * How many extra traffic packs a customer has bought for this instance. Kept on
 * the instance rather than derived from orders so the meter — read on every
 * dashboard load — never has to walk the order history.
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('instances', function (Blueprint $table) {
            $table->unsignedSmallInteger('traffic_addons')->default(0)->after('quota_gb');
        });
    }

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