<?php

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

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->increments('id');

            $table->string('name')->comment('品种名称');
            $table->string('standard')->nullable()->comment('规格');
            $table->string('package')->nullbale()->comment('包装比例');
            $table->string('product_name')->nullable()->comment('产品类型');
            $table->string('product_pici')->nullable()->comment('产品批次');
            $table->text('remark')->nullable()->comment('备注');

            $table->string('operator')->nullable()->comment('生产经营者');
            $table->string('skey')->nullable()->comment('单元识别码（首部添加）');
            $table->integer('bit')->default(12)->comment('单元识别码的位数（不包括首部添加）');


//            $table->string('product_name')->nullable()->comment('产品类型');
//            $table->string('product_pici')->nullable()->comment('产品批次');
//            $table->string('product_baozhuang')->nullable()->comment('包装级别');

            $table->string('consignor')->nullable()->comment('发货商');
            $table->date('delivery_time')->nullable()->comment('发货时间');
            $table->string('dealer')->nullable()->comment('经销商');

            $table->string('product_area')->nullable()->comment('产地');
            $table->string('process_pici')->nullable()->comment('加工批次');
            $table->string('higher_key')->nullable()->comment('上级码');
            $table->text('data')->nullable()->comment('扩展字段');
            $table->string('number')->comment('数量');

            $table->string('group')->nullable()->comment('分组单位');

            $table->integer('look_count')->default(0)->comment('查看的次数');

            $table->string('templet')->default(0)->comment('页面模板');
            $table->string('is_key', 8)->default('F')->comment('是否生成过key');

            $table->string('is_download', 8)->default('F')->comment('是否可以下载');
            $table->tinyInteger('slug_type')->default(0)->comment('slug类型');
            $table->tinyInteger('slug_num')->default(16)->comment('slug位数');

            $table->timestamps();
        });
    }

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