photo/database/migrations/2016_06_03_055604_create_photo_people_table.php

38 lines
737 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('person_photo', function(Blueprint $table)
{
$table->id();
$table->timestamps();
$table->bigInteger('person_id');
$table->foreign('person_id')->references('id')->on('people');
$table->bigInteger('photo_id');
$table->foreign('photo_id')->references('id')->on('photos');
$table->unique(['person_id','photo_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('person_photo');
}
};