Merge pull request #350 from shikorism/fix/unique-metadata-and-tags
metadata.urlをPKに、tags.nameをUNIQUEに設定
This commit is contained in:
commit
5db25ce017
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class MakePrimaryKeyOnMetadata extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('metadata', function (Blueprint $table) {
|
||||
$table->dropIndex(['url']);
|
||||
$table->primary('url');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('metadata', function (Blueprint $table) {
|
||||
$table->dropPrimary(['url']);
|
||||
$table->index('url');
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddUniqueConstraintToTags extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tags', function (Blueprint $table) {
|
||||
$table->unique('name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tags', function (Blueprint $table) {
|
||||
$table->dropUnique(['name']);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user