<?php

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

class CreateCareerDescriptionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('career_descriptions', function (Blueprint $table) {
            $table->id();
            $table->string('type', 100)->nullable();
            $table->string('name', 100)->nullable();
            $table->text('description')->nullable();

            $table->unsignedBigInteger('career_id')->index();
            $table->unsignedBigInteger('language_id')->index();

            $table->foreign('career_id')->references('id')->on('careers')->cascadeOnDelete();

            $table->engine = 'InnoDB';
        });
    }

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