<?php

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

class CreatePackagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('packages', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('logistic_number')->unique()->comment('快递单号');
            $table->enum('type',['普通波次','活动波次'])->default('普通波次')->index()->comment('波次类型');
            $table->decimal('weight')->comment('重KG');
            $table->decimal('length')->index()->comment('长(cm)');
            $table->decimal('width')->index()->comment('宽(cm)');
            $table->decimal('height')->index()->comment('高(cm)');
            $table->bigInteger('owner_id')->index()->comment('外键货主');
            $table->bigInteger('paper_box_id')->index()->comment('外键纸箱');
            $table->bigInteger('measuring_machine_id')->index()->comment('外键设备');
            $table->string('recipient')->comment('收件人');
            $table->enum('status',['无','未上传','已上传','异常'])->default('无')->comment('包裹信息状态');
            $table->timestamps();
        });
    }

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