<?php

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

class CreateCmmsFormsHistoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cmms_forms_histories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('cmms_form_id');
            $table->foreign('cmms_form_id')->references('id')->on('cmms_forms')->onUpdate('cascade');
            $table->unsignedBigInteger('user_id');
            $table->foreign('user_id')->references('id')->on('users');
            $table->string('previous_chassis_number')->nullable();
            $table->string('previous_province_id')->nullable();
            $table->string('previous_province_fa')->nullable();
            $table->string('previous_city_id')->nullable();
            $table->string('previous_city_fa')->nullable();
            $table->string('previous_device_name')->nullable();
            $table->string('previous_operator_name')->nullable();
            $table->string('previous_operator_nationalcode')->nullable();
            $table->string('previous_operator_phone')->nullable();
            $table->timestamps();
        });
    }

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