<?php

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

class ChangeOrderPackagesAddColumn extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('order_packages', function (Blueprint $table) {
            $table->string('batch_number')->nullable()->index()->comment('波次号');
            $table->string('batch_rule')->nullable()->index()->comment('波次规则');
            $table->decimal('bulk',16,2)->nullable()->comment('体积');
            $table->decimal('weight')->nullable()->comment('重KG');
            $table->decimal('length')->nullable()->comment('长(cm)');
            $table->decimal('width')->nullable()->comment('宽(cm)');
            $table->decimal('height')->nullable()->comment('高(cm)');
            $table->bigInteger('paper_box_id')->nullable()->index()->comment('外键纸箱');
            $table->bigInteger('measuring_machine_id')->nullable()->index()->comment('外键设备');
            $table->dateTime('weighed_at')->nullable()->comment('称重时间');
            $table->enum('status',['无','未上传','已上传','未测量','未下发','上传异常','下发异常','记录异常','已上传异常','测量异常'])->default('无')->comment('包裹信息状态');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('order_packages', function (Blueprint $table) {
            $table->dropColumn('batch_number');
            $table->dropColumn('batch_rule');
            $table->dropColumn('bulk');
            $table->dropColumn('weight');
            $table->dropColumn('length');
            $table->dropColumn('width');
            $table->dropColumn('height');
            $table->dropColumn('paper_box_id');
            $table->dropColumn('measuring_machine_id');
            $table->dropColumn('weighed_at');
            $table->dropColumn('status');
        });
    }
}
