This commit is contained in:
pbao9
2026-02-03 16:10:49 +07:00
parent 6178a76eee
commit 0dbd9bfebe
12 changed files with 446 additions and 206 deletions
@@ -16,8 +16,7 @@ return new class extends Migration
Schema::create('module_ip_address',function (Blueprint $table) {
$table->id()->autoIncrement();
$table->string('vm_name',255)->nullable();
$table->bigInteger('module_host_id')->default(0)->index();
$table->bigInteger('module_network_id')->default(0)->index();
$table->foreignId('module_network_id')->nullable()->constrained('module_network')->onDelete('set null')->index();
$table->string('ip',100)->nullable();
$table->string('gateway',100)->nullable();
$table->string('netmask',100)->nullable();
@@ -12,10 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('module_ip_address', function (Blueprint $table) {
$table->unsignedBigInteger('module_host_id')->nullable()->default(null)->change();
$table->unsignedBigInteger('module_network_id')->nullable()->default(null)->change();
$table->foreign('module_host_id')->references('id')->on('module_host')->onDelete('set null');
$table->foreign('module_network_id')->references('id')->on('module_network')->onDelete('set null');
});
}
@@ -26,10 +23,7 @@ return new class extends Migration
public function down(): void
{
Schema::table('module_ip_address', function (Blueprint $table) {
$table->dropForeign(['module_host_id']);
$table->dropForeign(['module_network_id']);
$table->bigInteger('module_host_id')->default(0)->nullable(false)->change();
$table->bigInteger('module_network_id')->default(0)->nullable(false)->change();
});
}
@@ -0,0 +1,31 @@
<?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('os_product', function (Blueprint $table) {
$table->id();
$table->foreignId('product_id')->constrained('products')->onDelete('cascade');
$table->foreignId('os_id')->constrained('os')->onDelete('cascade');
$table->timestamps();
$table->unique(['product_id', 'os_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('os_product');
}
};