<?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('client_domains', function (Blueprint $t) { $t->id(); $t->unsignedInteger('client_id'); $t->unsignedInteger('tld_id'); $t->string('domain', 255); $t->enum('status', ['pending','active','expired','suspended','transferred'])->default('active'); $t->boolean('pending_cancellation')->default(0); $t->timestamp('cancellation_date')->nullable(); $t->string('lifecycle_status', 20)->default('active'); $t->string('module', 255)->nullable(); $t->integer('period')->default(1); $t->date('create_date')->nullable(); $t->date('expire_date')->nullable(); $t->date('grace_start_date')->nullable(); $t->date('redemption_start_date')->nullable(); $t->date('due_date')->nullable(); $t->date('next_due_date')->nullable(); $t->date('invoice_date')->nullable(); $t->date('last_check')->nullable(); $t->boolean('dns_management')->nullable(); $t->boolean('email_forwarding')->nullable(); $t->boolean('id_protection')->nullable(); $t->boolean('epp_code')->nullable(); $t->string('transfer_epp_code', 255)->nullable(); $t->boolean('is_premium')->default(0); $t->decimal('premium_purchase_amount', 10, 2)->nullable(); $t->decimal('premium_register_price', 12, 2)->nullable(); $t->decimal('premium_renew_price', 12, 2)->nullable(); $t->decimal('premium_transfer_price', 12, 2)->nullable(); $t->boolean('disable_reminders')->default(0); $t->boolean('auto_renew')->default(0); $t->enum('provisioning_status', ['pending','queued','processing','completed','failed','manual'])->default('pending'); $t->unsignedInteger('provisioning_attempt')->default(0); $t->text('provisioning_error')->nullable(); $t->timestamp('provisioned_at')->nullable(); $t->timestamp('last_provisioning_attempt')->nullable(); $t->timestamp('last_sync_at')->nullable(); $t->text('sync_error')->nullable(); $t->json('cached_data')->nullable(); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->timestamp('deleted_at')->nullable(); $t->index('client_id', 'client_domains_client_id_index'); $t->index('expire_date', 'client_domains_expire_date_index'); $t->index(['lifecycle_status', 'expire_date'], 'client_domains_lifecycle_status_expire_date_index'); $t->index('lifecycle_status', 'client_domains_lifecycle_status_index'); $t->index('provisioning_status', 'client_domains_provisioning_status_index'); $t->index('status', 'client_domains_status_index'); $t->index('tld_id', 'client_domains_tld_id_index'); }); } public function down(): void { Schema::dropIfExists('client_domains'); } }; 