feat(vm): hoàn tiền khi cấp VM lỗi, theo dõi job queue, uuid dịch vụ cho ticket, chuẩn hoá RAM addon
- VmProvisionException/VmProvisionRefund xử lý lỗi cấp phát VM - QueueJobInspector + QueueMonitorController xem chi tiết job - Thêm service uuid cho ticket, thời lượng cho activity_logs - Migration chuẩn hoá RAM addon sang MB, trạng thái deleting cho snapshot Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
7136bec265
commit
62596d9063
@@ -0,0 +1,22 @@
|
||||
<?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::table('ticket', function (Blueprint $table) {
|
||||
$table->uuid('service_uuid')->nullable()->index()->after('customer_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('ticket', function (Blueprint $table) {
|
||||
$table->dropColumn('service_uuid');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('service_addons')
|
||||
->where('addon_type', 'ram')
|
||||
->whereRaw('CAST(addon_value AS UNSIGNED) < 256')
|
||||
->update(['addon_value' => DB::raw('CAST(addon_value AS UNSIGNED) * 1024')]);
|
||||
|
||||
DB::table('module_vmware as m')
|
||||
->join('services as s', 's.vm_id', '=', 'm.id')
|
||||
->join('products as p', 'p.id', '=', 's.product_id')
|
||||
->whereNull('m.ram_mb')
|
||||
->update([
|
||||
'm.cpu' => DB::raw('p.cpu'),
|
||||
'm.ram_mb' => DB::raw('p.ram * 1024'),
|
||||
'm.disk_gb' => DB::raw('p.disk'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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::table('activity_logs', function (Blueprint $table) {
|
||||
$table->timestamp('started_at', 3)->nullable()->after('user_agent');
|
||||
$table->timestamp('finished_at', 3)->nullable()->after('started_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('activity_logs', function (Blueprint $table) {
|
||||
$table->dropColumn(['started_at', 'finished_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement("ALTER TABLE module_snapshot MODIFY status ENUM('pending','processing','success','failed','deleting') NOT NULL DEFAULT 'pending'");
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('module_snapshot')->where('status', 'deleting')->update(['status' => 'success']);
|
||||
DB::statement("ALTER TABLE module_snapshot MODIFY status ENUM('pending','processing','success','failed') NOT NULL DEFAULT 'pending'");
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user