Files
panel-pelican-dev/database/migrations/2017_08_05_174811_SetAllocationUnqiueUsingMultipleFields.php

31 lines
743 B
PHP
Raw Normal View History

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
2024-03-19 21:03:50 -04:00
return new class extends Migration
{
/**
* Run the migrations.
*/
2024-03-19 21:12:27 -04:00
public function up(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->unique(['node_id', 'ip', 'port']);
});
}
/**
* Reverse the migrations.
*/
2024-03-19 21:12:27 -04:00
public function down(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropForeign(['node_id']);
$table->dropUnique(['node_id', 'ip', 'port']);
2017-08-23 12:34:34 -07:00
$table->foreign('node_id')->references('id')->on('nodes');
});
}
2024-03-19 21:03:50 -04:00
};