<?php

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

class CreateOwnerStoragePriceModelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('owner_storage_price_models', function (Blueprint $table) {
            $table->id();
            $table->enum("counting_type",["包仓","灵活用仓","统单价"])->default("灵活用仓")->comment('计费类型');
            $table->enum("using_type",["常温","恒温"])->default("常温")->comment('用仓类型');
            $table->decimal("minimum_area")->default(0)->comment("最低起租面积");
            $table->decimal("price",8,3)->comment("单价");
            $table->enum("discount_type",["无减免","按单减免","固定减免"])->default("无减免")->comment("减免类型");
            $table->decimal("discount_value")->nullable()->comment("减免值");
            $table->bigInteger("unit_id")->nullable()->index()->comment("外键单位");
            $table->timestamps();
        });
    }

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