<?php

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

class CountriesLanguages extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
        Schema::create('country_languages', function (Blueprint $table) {
            $table->increments('translation_id');
            $table->unsignedInteger('country_id');
            $table->string('language_id', 10);
            $table->string('title', 150);

            $table->unique(['country_id', 'language_id'], 'idx_country_lang');
            $table->foreign('country_id')->references('id')
                ->on('countries')->onDelete('CASCADE')->onUpdate('CASCADE');

        });
	}

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

}
