<?php

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

class CreateFieldOptionLanguagesTable extends Migration
{
    public function up()
    {
        Schema::create('field_option_languages', function (Blueprint $table) {
            $table->bigIncrements('translation_id');
            $table->unsignedBigInteger('field_option_id');
            $table->string('language_id', 10);
            $table->string('title', 150);
            $table->string('label', 250);

            $table->foreign('field_option_id')->references('id')->on('field_options')->onDelete('cascade');
            $table->index(['field_option_id', 'language_id']);
        });
    }

    public function down()
    {
        Schema::dropIfExists('field_option_languages');
    }
}
