Add a unique constraint on paddock names
This commit is contained in:
@@ -13,7 +13,8 @@
|
|||||||
"fruitcake/laravel-cors": "^1.0",
|
"fruitcake/laravel-cors": "^1.0",
|
||||||
"guzzlehttp/guzzle": "^6.3",
|
"guzzlehttp/guzzle": "^6.3",
|
||||||
"laravel/framework": "^7.0",
|
"laravel/framework": "^7.0",
|
||||||
"laravel/tinker": "^2.0"
|
"laravel/tinker": "^2.0",
|
||||||
|
"doctrine/dbal": "^2.10"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"facade/ignition": "^2.0",
|
"facade/ignition": "^2.0",
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddUniqueConstraintOnPaddockNames extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('paddocks', function (Blueprint $table) {
|
||||||
|
$table->string('name')->unique()->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('paddocks', function (Blueprint $table) {
|
||||||
|
$table->dropUnique('name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user