<?php

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

class CreateInventoryComparesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('inventory_compares', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('owner_id')->index();
            $table->integer('commodity_id')->index();
            $table->string('mission_code')->nullable()->comment('任务号');
            $table->enum('source',['客户表','无'])->default('客户表')->index()->comment('来源');
            $table->string('custom_location')->nullable()->comment('属性仓');
            $table->enum('quality',['正品','次品','未知'])->comment('质量状态');
            $table->integer('amount_in_sys')->nullable()->comment('宝时库存');
            $table->integer('amount_in_compare')->nullable()->comment('参考库存');
            $table->integer('differ')->index()->default(0)->comment('差值');
            $table->timestamp('created_at')->index()->nullable();
            $table->timestamp('updated_at')->nullable();
        });
    }

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