<?php

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

class AddGoalRateToGoodsSkusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasColumn('goods_skus', 'goal_rate')) {
            return;
        }
        Schema::table('goods_skus', function (Blueprint $table) {
            $table->decimal('goal_rate', 8, 4)->default(0)->comment('目标去化率');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('goods_skus', function (Blueprint $table) {
            $table->dropColumn('goal_rate');
        });
    }
}
