Add VM rebuild pipeline with isolated job chain and admin log API
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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
|
||||
{
|
||||
// Broaden the status enum to a free-form string so the rebuild
|
||||
// pipeline can use 'pending'/'in_progress'/'completed'/'failed'.
|
||||
DB::statement("ALTER TABLE reinstall_logs MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT 'pending'");
|
||||
|
||||
Schema::table('reinstall_logs', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('service_id')->nullable()->after('custome_id');
|
||||
$table->string('old_vmware_id')->nullable()->after('template_id');
|
||||
$table->string('new_vmware_id')->nullable()->after('old_vmware_id');
|
||||
// Plaintext + encrypted copy of the credential applied to the
|
||||
// new VM. Encrypted column uses SignRSA so it matches the
|
||||
// existing module_vmware.password format.
|
||||
$table->text('password')->nullable()->after('ip_address');
|
||||
$table->text('plain_password')->nullable()->after('password');
|
||||
$table->boolean('password_supplied_by_customer')->default(false)->after('plain_password');
|
||||
$table->timestamp('started_at')->nullable()->after('error_message');
|
||||
$table->timestamp('completed_at')->nullable()->after('started_at');
|
||||
|
||||
$table->index('service_id');
|
||||
$table->index('custome_id');
|
||||
$table->index('status');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('reinstall_logs', function (Blueprint $table) {
|
||||
$table->dropIndex(['service_id']);
|
||||
$table->dropIndex(['custome_id']);
|
||||
$table->dropIndex(['status']);
|
||||
$table->dropColumn([
|
||||
'service_id',
|
||||
'old_vmware_id',
|
||||
'new_vmware_id',
|
||||
'password',
|
||||
'plain_password',
|
||||
'password_supplied_by_customer',
|
||||
'started_at',
|
||||
'completed_at',
|
||||
]);
|
||||
});
|
||||
|
||||
DB::statement(
|
||||
"ALTER TABLE reinstall_logs MODIFY COLUMN status ENUM('pending','success','failed') NOT NULL DEFAULT 'pending'"
|
||||
);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user