Prevent duplicate allocations for servers

This commit is contained in:
Dane Everitt 2018-02-17 13:53:38 -06:00
parent 241f7d0125
commit d86c35d80f
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 35 additions and 2 deletions

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class EnsureUniqueAllocationIdOnServersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->unique(['allocation_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropUnique(['allocation_id']);
});
}
}