<?php

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

class CreateSlideshowsLangTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('slideshows_lang', function (Blueprint $table) {
            $table->increments('translation_id');
            $table->unsignedInteger('slideshow_id');
            $table->string('language_id', 10);
            $table->string('title', 150);
            $table->string('date', 100);

            $table->unique(['slideshow_id', 'language_id'], 'idx_slideshows_lang');

            $table->foreign('slideshow_id')->references('id')
                ->on('slideshows')->onDelete('CASCADE')->onUpdate('CASCADE');
        });
    }

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