<?php

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

class CreateStoreItemsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('store_items', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('store_id')->index()->comment('外键入库表');
            $table->string('asn_line_code')->nullable()->comment('来自WMS的ASN行号，唯一');
            $table->string('name')->nullable();
            $table->string('sku')->nullable()->index();
            $table->string('barcode')->nullable()->index();
            $table->integer('depository_id')->nullable()->index()->comment('属性仓ID');
            $table->integer('amount')->default(0);
            $table->enum('quality',['无','正品','残次'])->default('正品');
            $table->enum('status',['无需入库','已入库','未入库','待推单'])->nullable();
            $table->timestamps();
        });
    }

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