update logic
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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('customers', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('legacy_id')->nullable()->unique()->after('id');
|
||||
});
|
||||
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('legacy_id')->nullable()->unique()->after('id');
|
||||
$table->unsignedBigInteger('legacy_product_id')->nullable()->index()->after('product_id');
|
||||
});
|
||||
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('legacy_id')->nullable()->unique()->after('id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('customers', fn (Blueprint $t) => $t->dropColumn('legacy_id'));
|
||||
Schema::table('services', function (Blueprint $t) {
|
||||
$t->dropColumn(['legacy_id', 'legacy_product_id']);
|
||||
});
|
||||
Schema::table('products', fn (Blueprint $t) => $t->dropColumn('legacy_id'));
|
||||
}
|
||||
};
|
||||
@@ -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('module_vmware', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('legacy_id')->nullable()->unique()->after('id');
|
||||
$table->unsignedBigInteger('virtual_machine_id')->nullable()->index()->after('vmware_id')
|
||||
->comment('FK → virtual_machines.id when the vCenter VM still exists');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('module_vmware', function (Blueprint $table) {
|
||||
$table->dropColumn(['legacy_id', 'virtual_machine_id']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user