This commit is contained in:
pbao9
2026-01-29 15:52:23 +07:00
parent d2532bcddd
commit 73c5b6752f
15 changed files with 598 additions and 314 deletions
BIN
View File
Binary file not shown.
@@ -0,0 +1,59 @@
<?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('products', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->unique();
// Product type
$table->string('product_type', 50)->index();
// Basic info
$table->string('name');
$table->string('slug')->unique();
$table->string('short_description')->nullable();
$table->text('description')->nullable();
// Pricing
$table->decimal('price', 12, 2)->nullable();
$table->decimal('price_sale', 12, 2)->nullable();
$table->decimal('setup_fee', 12, 2)->default(0);
$table->string('currency', 10)->default('USD');
$table->string('billing_cycle')->default('monthly');
// Trial / stock
$table->unsignedInteger('trial_days')->default(0);
$table->integer('stock')->nullable();
$table->boolean('is_unlimited')->default(true);
// Hardware specs (VPS)
$table->string('cpu')->nullable();
$table->string('ram')->nullable();
$table->string('gpu')->nullable();
$table->string('disk')->nullable();
$table->string('bandwidth')->nullable();
// Extra
$table->json('features')->nullable();
$table->json('metadata')->nullable();
$table->boolean('is_active')->default(true);
$table->integer('sort_order')->default(0);
$table->timestamp('published_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('products');
}
};
@@ -0,0 +1,38 @@
<?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::create('virtual_machines', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->unique();
$table->string('vm_id')->unique();
$table->string('name');
$table->boolean('is_template')->default(false);
// Specs snapshot
$table->integer('cpu')->nullable();
$table->integer('ram_mb')->nullable();
$table->integer('disk_gb')->nullable();
// Mapping
$table->foreignId('datacenter_id')->constrained('module_datacenter')->nullable();
$table->foreignId('host_id')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('virtual_machines');
}
};
@@ -0,0 +1,27 @@
<?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::create('product_v_m_templates', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('product_v_m_templates');
}
};