<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class TemplateTitles extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('template_title', function (Blueprint $table) {
			$table->increments('id');
			$table->integer('title_id')->unsigned();
			$table->foreign('title_id')
				->references('id')
				->on('titles')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('position');
			$table->integer('template_id')->unsigned();
			$table->foreign('template_id')
				->references('id')
				->on('templates')
				->onDelete('cascade')
				->onUpdate('cascade');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('template_title');
	}
}
