<?php

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

class LocationsLanguages extends Migration {

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

            $table->string('location_lat', 150)->nullable();
            $table->string('location_lng', 150)->nullable();

            $table->unique(['location_id', 'language_id'], 'idx_location_lang');
            $table->foreign('location_id')->references('id')
                ->on('locations')->onDelete('CASCADE')->onUpdate('CASCADE');

        });
	}

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

}
