<?php

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

class CreateOwnerFeeDetailLogisticsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('owner_fee_detail_logistics', function (Blueprint $table) {
            $table->id();
            $table->bigInteger("owner_fee_detail_id")->index()->comment("外键即时账单");
            $table->integer("amount")->comment("商品数量");
            $table->string('logistic_bill')->nullable()->comment('快递单号');
            $table->decimal('volume',8,3)->nullable()->comment('体积');
            $table->decimal('weight',8,3)->nullable()->comment('重量');
            $table->decimal('logistic_fee',8,4)->nullable()->comment('物流费');
        });
        Schema::table("features",function(Blueprint $table){
            $table->dropColumn("type");
        });
        Schema::table("features",function(Blueprint $table){
            $table->tinyInteger("type")->default(0)->index()->comment("特征类型");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table("features",function(Blueprint $table){
            $table->dropColumn("type");
        });
        Schema::table("features",function(Blueprint $table){
            $table->enum("type",["商品名称","订单类型","承运商","店铺类型"])->index()->comment("特征类型");
        });
        Schema::dropIfExists('owner_fee_detail_logistics');
    }
}
