<?php

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

class CreateBusinessOrderItemsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('business_order_items', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('shop_id');
            $table->bigInteger('business_order_id');
            $table->integer('already_cancel_number')->nullable();
            $table->integer('cancel_status')->nullable();
            $table->string('category_name')->nullable();
            $table->string('external_sku_id')->nullable();
            $table->bigInteger('goods_amount')->nullable();
            $table->bigInteger('goods_cost_price')->nullable();
            $table->bigInteger('goods_id')->nullable();
            $table->string('goods_name')->nullable();
            $table->integer('goods_number')->nullable();
            $table->bigInteger('goods_price')->nullable();
            $table->bigInteger('goods_purchase_price')->nullable();
            $table->string('goods_specification')->nullable();
            $table->bigInteger('help_sell_amount')->nullable();
            $table->boolean('is_supplier')->nullable();
            $table->integer('need_verification_number')->nullable();
            $table->integer('shipping_status')->nullable();
            $table->bigInteger('sku_id')->nullable();
            $table->string('sub_order_sn')->nullable();
            $table->bigInteger('theoretically_refund_amount')->nullable();
            $table->string('thumb_url')->nullable();
            $table->integer('verification_number')->nullable();
            $table->timestamps();
            // 索引
            $table->index(['shop_id', 'business_order_id', 'goods_id', 'sku_id']);
        });
    }

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