Files

35 lines
851 B
PHP
Raw Permalink Normal View History

<?php
2026-10-05 18:10:18 -04:00
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
2026-10-05 18:10:18 -04:00
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetAllocationToReferenceNullOnServerDelete extends Migration
{
/**
* Run the migrations.
*/
2024-10-21 19:18:20 -06:00
public function up(): void
{
2026-10-05 18:10:18 -04:00
Schema::table('allocations', function (Blueprint $table): void {
$table->dropForeign(['server_id']);
$table->foreign('server_id')->references('id')->on('servers')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*/
2024-10-21 19:18:20 -06:00
public function down(): void
{
2026-10-05 18:10:18 -04:00
Schema::table('allocations', function (Blueprint $table): void {
$table->dropForeign(['server_id']);
$table->foreign('server_id')->references('id')->on('servers');
});
}
}