<?php

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

class CreateWorkExperiencesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('work_experiences', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('user_id')->unsigned();
            $table->string('company', 100);
            $table->enum('type_company', ['1', '2'])->default('1');
            $table->string('department', 100);
            $table->string('title_position', 100);
            $table->string('direction', 500);
            $table->string('phone', 15)->nullable();
            $table->date('date_entry');
            $table->date('date_retirement');
            $table->text('responsibilities');
            $table->enum('is_currently_working_here',['0', '1'])->default('0');
            $table->string('document_upload', 255)->nullable();
            $table->foreign('user_id')->references('id')->on('users')
            ->onDelete('cascade')
            ->onUpdate('cascade');
            $table->timestamps();
        });
    }

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