feat: Reorganize database migrations for module snapshots, VMware, and OS groups, and implement customer order creation email notifications.
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('module_vmware', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable();
|
||||
|
||||
$table->foreignId('module_ip_address')
|
||||
->constrained('module_ip_address')->nullable();
|
||||
|
||||
$table->foreignId('vcenter_id')
|
||||
->constrained('module_vcenter')->nullable();
|
||||
|
||||
$table->integer('port')->nullable();
|
||||
$table->integer('order_id')->nullable();
|
||||
|
||||
$table->integer('first_payment')->nullable();
|
||||
$table->integer('next_payment')->nullable();
|
||||
$table->integer('next_due_date')->nullable();
|
||||
$table->integer('next_invoice')->nullable();
|
||||
|
||||
$table->string('user')->nullable();
|
||||
$table->text('password')->nullable();
|
||||
$table->string('hostname')->nullable();
|
||||
$table->string('vmware_id')->nullable();
|
||||
|
||||
$table->bigInteger('os_id')->default(0)->index();
|
||||
$table->bigInteger('customer_id')->default(0)->index();
|
||||
|
||||
$table->tinyInteger('status')
|
||||
->default(1)
|
||||
->comment('1: Running;0:Off;2:Suspend');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('module_vmwares');
|
||||
}
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('module_snapshot', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 255)->nullable();
|
||||
$table->bigInteger('customer_id')->default(0)->index();
|
||||
$table->bigInteger('module_vmware_id')->default(0)->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('module_snapshots');
|
||||
}
|
||||
};
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('module_snapshot', function (Blueprint $table) {
|
||||
$table->text('description')->nullable()->after('name');
|
||||
|
||||
// Async snapshot status
|
||||
$table->enum('status', [
|
||||
'pending',
|
||||
'processing',
|
||||
'success',
|
||||
'failed'
|
||||
])->default('pending')->index()->after('module_vmware_id');
|
||||
|
||||
// vCenter mapping
|
||||
$table->string('snapshot_ref')->nullable()->comment('Snapshot ID / moRef from vCenter');
|
||||
$table->string('vcenter_task_id')->nullable()->comment('Task ID from vCenter');
|
||||
|
||||
// Error handling
|
||||
$table->text('error_message')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('module_snapshot', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'description',
|
||||
'status',
|
||||
'snapshot_ref',
|
||||
'vcenter_task_id',
|
||||
'error_message',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('module_snapshot', function (Blueprint $table) {
|
||||
//
|
||||
$table->unsignedBigInteger('size_bytes')
|
||||
->nullable()
|
||||
->comment('Snapshot size in bytes');
|
||||
|
||||
$table->decimal('size_gb', 10, 2)
|
||||
->nullable()
|
||||
->comment('Snapshot size in GB');
|
||||
|
||||
$table->timestamp('size_last_synced_at')
|
||||
->nullable()
|
||||
->comment('Last time snapshot size was synced');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('module_snapshot', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -43,7 +43,6 @@ return new class extends Migration
|
||||
|
||||
$table->string('payment_method', 100)->nullable();
|
||||
$table->boolean('auto_renew')->default(false);
|
||||
|
||||
$table->date('due_date')->nullable();
|
||||
$table->timestamp('paid_at')->nullable();
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('module_vmware', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->string('name')->nullable();
|
||||
|
||||
$table->unsignedBigInteger('module_ip_address')->nullable()->index();
|
||||
$table->unsignedBigInteger('vcenter_id')->nullable()->index();
|
||||
|
||||
$table->integer('port')->nullable();
|
||||
|
||||
$table->unsignedBigInteger('order_id')->nullable()->index();
|
||||
|
||||
$table->integer('first_payment')->nullable();
|
||||
$table->integer('next_payment')->nullable();
|
||||
$table->integer('next_due_date')->nullable();
|
||||
$table->integer('next_invoice')->nullable();
|
||||
|
||||
$table->string('user')->nullable();
|
||||
$table->text('password')->nullable();
|
||||
$table->string('hostname')->nullable();
|
||||
$table->string('vmware_id')->nullable();
|
||||
|
||||
$table->unsignedBigInteger('os_id')->nullable()->index();
|
||||
$table->unsignedBigInteger('customer_id')->nullable()->index();
|
||||
|
||||
$table->tinyInteger('status')
|
||||
->default(1)
|
||||
->comment('1: Running; 0: Off; 2: Suspend');
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Foreign Keys
|
||||
$table->foreign('module_ip_address')
|
||||
->references('id')
|
||||
->on('module_ip_address')
|
||||
->nullOnDelete();
|
||||
|
||||
$table->foreign('vcenter_id')
|
||||
->references('id')
|
||||
->on('module_vcenter')
|
||||
->nullOnDelete();
|
||||
|
||||
$table->foreign('order_id')
|
||||
->references('id')
|
||||
->on('orders')
|
||||
->nullOnDelete();
|
||||
|
||||
$table->foreign('os_id')
|
||||
->references('id')
|
||||
->on('os')
|
||||
->nullOnDelete();
|
||||
|
||||
$table->foreign('customer_id')
|
||||
->references('id')
|
||||
->on('customers')
|
||||
->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('module_vmware');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('module_snapshot', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 255)->nullable();
|
||||
|
||||
$table->unsignedBigInteger('customer_id')->nullable()->index();
|
||||
$table->unsignedBigInteger('module_vmware_id')->nullable()->index();
|
||||
|
||||
$table->text('description')->nullable();
|
||||
|
||||
// Async snapshot status
|
||||
$table->enum('status', [
|
||||
'pending',
|
||||
'processing',
|
||||
'success',
|
||||
'failed'
|
||||
])->default('pending')->index();
|
||||
|
||||
// vCenter mapping
|
||||
$table->string('snapshot_ref')->nullable()->comment('Snapshot ID / moRef from vCenter');
|
||||
$table->string('vcenter_task_id')->nullable()->comment('Task ID from vCenter');
|
||||
$table->unsignedBigInteger('size_bytes')
|
||||
->nullable()
|
||||
->comment('Snapshot size in bytes');
|
||||
|
||||
$table->decimal('size_gb', 10, 2)
|
||||
->nullable()
|
||||
->comment('Snapshot size in GB');
|
||||
|
||||
$table->timestamp('size_last_synced_at')
|
||||
->nullable()
|
||||
->comment('Last time snapshot size was synced');
|
||||
// Error handling
|
||||
$table->text('error_message')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('customer_id')
|
||||
->references('id')
|
||||
->on('customers')
|
||||
->nullOnDelete();
|
||||
|
||||
$table->foreign('module_vmware_id')
|
||||
->references('id')
|
||||
->on('module_vmware')
|
||||
->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('module_snapshots');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user