FEATURE: make nicer URL uniqueness check

This commit is contained in:
Michal Kváček
2016-10-25 20:11:58 +02:00
parent 988f153d9f
commit 000352052d
3 changed files with 42 additions and 7 deletions
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddUniqueKeyToDeletedAtInContents extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('contents', function (Blueprint $table) {
$table->dropUnique(['language', 'url']);
$table->unique(['language', 'url', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('contents', function (Blueprint $table) {
$table->dropUnique(['language', 'url', 'deleted_at']);
$table->unique(['language', 'url']);
});
}
}