37 lines
615 B
PHP
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');
|
||
|
}
|
||
|
|
||
|
}
|