?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('servers', function (Blueprint $table) { $table->id(); $table->foreignId('customer_id')->constrained()->cascadeOnDelete()->index(); $table->foreignId('company_id')->nullable()->constrained()->nullOnDelete()->index(); $table->foreignId('service_id')->nullable()->constrained()->nullOnDelete(); $table->string('hostname'); $table->string('primary_ip')->nullable(); $table->string('ipv6')->nullable(); $table->json('secondary_ips')->nullable(); $table->string('os')->nullable(); $table->string('os_version')->nullable(); $table->string('provider')->nullable(); $table->string('datacenter')->nullable(); $table->string('cpu')->nullable(); $table->unsignedInteger('ram_gb')->nullable(); $table->string('disk')->nullable(); $table->string('disk_type')->nullable(); $table->string('panel')->nullable(); // cpanel|plesk|directadmin|none $table->string('panel_url')->nullable(); $table->text('panel_username')->nullable(); $table->text('panel_password_encrypted')->nullable(); $table->text('root_password_encrypted')->nullable(); $table->unsignedSmallInteger('ssh_port')->default(22); $table->foreignId('assigned_engineer_id')->nullable()->constrained('users')->nullOnDelete(); $table->string('monitoring_status')->default('unknown'); $table->boolean('locked')->default(true); $table->text('notes')->nullable(); $table->json('tags')->nullable(); $table->timestamp('activated_at')->nullable(); $table->timestamps(); $table->softDeletes(); }); } public function down(): void { Schema::dropIfExists('servers'); } };