Wrap in transaction

This commit is contained in:
Lance Pioch 2024-06-15 07:19:01 -04:00
parent 6976fa8989
commit eff8e509ef

View File

@ -2,6 +2,7 @@
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
@ -11,6 +12,7 @@ return new class extends Migration
*/
public function up(): void
{
DB::transaction(function () {
Schema::table('server_transfers', function (Blueprint $table) {
$table->dropColumn(['old_allocation', 'new_allocation', 'old_additional_allocations', 'new_additional_allocations']);
});
@ -37,7 +39,7 @@ return new class extends Migration
}
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign(['allocation_id']);
$table->dropUnique(['allocation_id']);
$table->dropColumn(['allocation_id']);
});
@ -46,6 +48,7 @@ return new class extends Migration
Schema::table('nodes', function (Blueprint $table) {
$table->boolean('strict_ports')->default(true);
});
});
}
/**