Make file field unique

This commit is contained in:
Dane Everitt 2016-02-20 15:59:04 -05:00
parent ad5e253a07
commit 4e60adc875
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddUniqueServiceField extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('services', function (Blueprint $table) {
$table->string('file')->unique()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('services', function (Blueprint $table) {
$table->dropUnique('services_file_unique');
});
}
}