photo/database/migrations/2016_06_03_055604_create_photo_tag_table.php
2016-06-22 16:53:48 +10:00

37 lines
615 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePhotoTagTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('photo_tag', function(Blueprint $table)
{
$table->bigInteger('id', true);
$table->timestamps();
$table->bigInteger('photo_id');
$table->bigInteger('tag_id')->index('pt_t_idx');
$table->unique(['photo_id','tag_id'], 'UNIQUE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('photo_tag');
}
}