<?php

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

class ChangePriceModelStorage extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('owner_in_storage_rules', function (Blueprint $table) {
            $table->enum("strategy",["起步","默认","特征"])->comment("入库策略");
            $table->string("feature")->nullable()->comment("特征");
            $table->integer("priority")->default(0)->index()->comment("匹配优先级(越大越优先)");
        });
        Schema::table('owner_in_storage_rules', function (Blueprint $table) {
            $table->rename("owner_price_operation_item_ins");
        });
        Schema::table('owner_out_storage_rules', function (Blueprint $table) {
            $table->rename("owner_price_operation_item_outs");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('owner_price_operation_item_ins', function (Blueprint $table) {
            $table->removeColumn("strategy");
            $table->removeColumn("feature");
            $table->removeColumn("priority");
        });
        Schema::table('owner_price_operation_item_ins', function (Blueprint $table) {
            $table->rename("owner_in_storage_rules");
        });
        Schema::table('owner_price_operation_item_outs', function (Blueprint $table) {
            $table->rename("owner_out_storage_rules");
        });
    }
}
