<?php

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

class ChangeOwnerPriceOperationsTableAddColumnMarkType extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('owner_price_operations', function (Blueprint $table) {
            $table->tinyInteger("type_mark")->nullable()->comment("类型标记");
        });
        Schema::table('commodities', function (Blueprint $table) {
            $table->string("remark")->nullable()->comment("商品备注");
        });
        Schema::table('owner_price_expresses', function (Blueprint $table) {
            $table->string("amount_interval")->nullable()->comment("数量区间");
            $table->string("weight_interval")->nullable()->comment("重量区间");
        });
        Schema::table('owner_price_express_provinces', function (Blueprint $table) {
            $table->string("initial_weight_price")->comment("初始单价区间")->change();
            $table->string("additional_weight_price")->comment("续重单价区间")->change();
        });
        Schema::table('owner_storage_price_models', function (Blueprint $table) {
            $table->string("amount_interval")->nullable()->comment("数量区间");
            $table->string("price")->comment("单价区间")->change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('owner_price_operations', function (Blueprint $table) {
            $table->dropColumn("type_mark");
        });
        Schema::table('commodities', function (Blueprint $table) {
            $table->dropColumn("remark");
        });
        Schema::table('owner_price_expresses', function (Blueprint $table) {
            $table->dropColumn("amount_interval");
            $table->dropColumn("weight_interval");
        });
        Schema::table('owner_price_express_provinces', function (Blueprint $table) {
            $table->decimal("initial_weight_price",8,4)->comment("初始单价")->change();
            $table->decimal("additional_weight_price",8,4)->comment("续重单价")->change();
        });
        Schema::table('owner_storage_price_models', function (Blueprint $table) {
            $table->dropColumn("amount_interval");
            $table->decimal("price",8,3)->comment("单价")->change();
        });
    }
}
