<?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_products', function (Blueprint $t) { $t->id(); $t->unsignedInteger('client_id'); $t->unsignedInteger('order_id')->nullable(); $t->unsignedInteger('group_id')->nullable(); $t->unsignedInteger('product_id'); $t->unsignedBigInteger('pending_product_id')->nullable(); $t->string('pending_billingcycle', 255)->nullable(); $t->json('pending_options')->nullable(); $t->boolean('upgrade_locked')->default(0); $t->unsignedInteger('server_id')->nullable(); $t->string('module', 255)->nullable(); $t->string('module_handler_id', 255)->nullable(); $t->string('domain', 255)->nullable(); $t->integer('quantity')->default(1); $t->string('billingcycle', 255)->nullable(); $t->decimal('recurring_amount', 10, 2)->nullable(); $t->date('create_date')->nullable(); $t->date('expire_date')->nullable(); $t->date('due_date')->nullable(); $t->date('next_due_date')->nullable(); $t->date('invoice_date')->nullable(); $t->date('activation_date')->nullable(); $t->date('suspend_date')->nullable(); $t->date('terminate_date')->nullable(); $t->enum('status', ['pending','active','suspended','terminated'])->default('active'); $t->boolean('is_trial')->default(0); $t->date('trial_ends_at')->nullable(); $t->boolean('pending_cancellation')->default(0); $t->timestamp('cancellation_date')->nullable(); $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->unsignedSmallInteger('failed_suspend_count')->default(0); $t->unsignedSmallInteger('failed_terminate_count')->default(0); $t->timestamp('last_suspend_attempt_at')->nullable(); $t->timestamp('last_terminate_attempt_at')->nullable(); $t->timestamp('suspended_at')->nullable(); $t->string('username', 255)->nullable(); $t->text('password')->nullable(); $t->string('suspend_reason', 255)->nullable(); $t->boolean('override_auto_suspend')->default(0); $t->date('override_suspend_until')->nullable(); $t->string('dedicated_ip', 255)->nullable(); $t->json('module_data')->nullable(); $t->unsignedBigInteger('ip_address_id')->nullable(); $t->text('notes')->nullable(); $t->boolean('disable_reminders')->default(0); $t->date('advance_notice_sent_for')->nullable(); $t->boolean('auto_renew')->default(0); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->timestamp('deleted_at')->nullable(); $t->index('ip_address_id', 'client_products_ip_address_id_foreign'); $t->index('provisioning_status', 'client_products_provisioning_status_index'); }); } public function down(): void { Schema::dropIfExists('client_products'); } }; 