<?php

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

class CreateLocationClerksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('location_clerks', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('stock_take_id')->nullable();
            $table->unsignedBigInteger('user_id');
            $table->string('company_code')->nullable();
            $table->string('plant_code')->nullable();
            $table->string('location_code')->nullable();
            $table->string('stock_take_date')->nullable();
            $table->enum('team', array('A', 'B'))->nullable();
            $table->enum('team_lead', array(1, 0))->default(0);
            $table->enum('status', array('active', 'closed'))->default('active');
            $table->foreign('stock_take_id')->references('id')->on('stock_takes');
            $table->foreign('user_id')->references('id')->on('users');
            $table->timestamps();
        });
    }

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