<?php

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

class CreateAnnexOthersContractUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('annex_others_contract_users', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('annex_other_id');
            $table->unsignedBigInteger('contract_user_id');
            $table->unsignedBigInteger('user_id');
            $table->unsignedBigInteger('company_id');
            $table->string('signature_company')->nullable();
            $table->string('signature_full_name')->nullable();
            $table->string('signature_position')->nullable();
            $table->string('signature_document_type')->nullable();
            $table->string('signature_document_number')->nullable();
            $table->string('signature_employee')->nullable();
            $table->longText('content_annex')->nullable();
            $table->unsignedBigInteger('created_by');
            $table->foreign('annex_other_id')->references('id')->on('annex_others');
            $table->foreign('contract_user_id')->references('id')->on('history_contracts_users');
            $table->foreign('user_id')->references('id')->on('users');
            $table->foreign('company_id')->references('id')->on('companies');
            $table->foreign('created_by')->references('id')->on('users');
            $table->timestamps();
        });
    }

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