<?php

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

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer("batch_id")->index()->nullable();
            $table->string("code")->index()->nullable();
            $table->integer("owner_id")->nullable();
            $table->enum("status",['处理中','未处理','已处理','取消','异常'])->default('未处理');
            $table->string("wms_status");

            $table->integer('shop_id')->index()->nullable()->comment('商铺');

            $table->integer("logistic_id")->index()->nullable()->comment('承运商');
            $table->string("consignee_name")->index()->nullable()->comment('收件人');
            $table->string("consignee_phone")->index()->nullable()->comment('收件人电话');

            $table->String("province")->nullable()->comment('省');
            $table->String("city")->nullable()->comment('市');
            $table->String("district")->nullable()->comment('区');

            $table->string("address")->nullable()->comment('地址');
            $table->timestamp('created_at')->index();
            $table->timestamp('updated_at')->index();

//            $table->string("logistic_number")->index()->nullable()->comment('承运单号');
//            $table->timestamps();
        });
    }

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