Fix hosting 500s: rc_service_orders migration and account layout.
Deploy Ladill Hosting / deploy (push) Successful in 22s

Account pages were extending the email layout with undefined routes, and hosting type pages queried a missing rc_service_orders table.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-06 16:41:27 +00:00
co-authored by Cursor
parent 2df303048c
commit c627d83e59
9 changed files with 150 additions and 60 deletions
@@ -0,0 +1,36 @@
<?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('rc_service_orders', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('category');
$table->string('domain_name');
$table->string('rc_order_id')->nullable()->index();
$table->string('rc_customer_id')->nullable();
$table->string('plan_id')->nullable();
$table->string('plan_name')->nullable();
$table->string('status')->default('pending');
$table->string('server_location')->nullable();
$table->string('ip_address')->nullable();
$table->string('access_url')->nullable();
$table->string('access_username')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamp('provisioned_at')->nullable();
$table->json('meta')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('rc_service_orders');
}
};
@@ -0,0 +1,74 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('rc_service_orders', function (Blueprint $table) {
$table->string('order_type')->default('service')->after('category')->index();
$table->string('payment_status')->default('unpaid')->after('status')->index();
$table->string('fulfillment_status')->default('cart')->after('payment_status')->index();
$table->string('payment_reference')->nullable()->after('fulfillment_status')->index();
$table->unsignedInteger('amount_minor')->nullable()->after('payment_reference');
$table->string('currency', 3)->default('GHS')->after('amount_minor');
$table->unsignedSmallInteger('term_months')->nullable()->after('currency');
$table->unsignedSmallInteger('term_years')->nullable()->after('term_months');
$table->timestamp('paid_at')->nullable()->after('term_years');
$table->timestamp('submitted_at')->nullable()->after('paid_at');
$table->timestamp('last_synced_at')->nullable()->after('submitted_at');
});
DB::table('rc_service_orders')
->orderBy('id')
->chunkById(200, function ($rows): void {
foreach ($rows as $row) {
$status = strtolower((string) ($row->status ?? 'pending'));
DB::table('rc_service_orders')
->where('id', (int) $row->id)
->update([
'order_type' => in_array((string) ($row->category ?? ''), ['domain-registration', 'domain-transfer'], true)
? ((string) $row->category === 'domain-transfer' ? 'domain_transfer' : 'domain_registration')
: 'service',
'payment_status' => 'paid',
'fulfillment_status' => match ($status) {
'active', 'suspended', 'cancelled', 'expired' => 'fulfilled',
'failed' => 'failed',
default => 'awaiting_vendor',
},
'currency' => 'GHS',
'submitted_at' => $row->created_at,
'last_synced_at' => $row->updated_at,
]);
}
});
}
public function down(): void
{
Schema::table('rc_service_orders', function (Blueprint $table) {
$table->dropIndex(['order_type']);
$table->dropIndex(['payment_status']);
$table->dropIndex(['fulfillment_status']);
$table->dropIndex(['payment_reference']);
$table->dropColumn([
'order_type',
'payment_status',
'fulfillment_status',
'payment_reference',
'amount_minor',
'currency',
'term_months',
'term_years',
'paid_at',
'submitted_at',
'last_synced_at',
]);
});
}
};