<?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');
	}
};