<?php

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

class CreateMallDeliveryRulesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('mall_delivery_rules', function (Blueprint $table) {
            $table->id();
            $table->integer('delivery_id')->comment('配送模板id');
            $table->json('regions')->nullable()->comment('可配送区域(城市id集)');
            $table->decimal('first', 8, 2)->default(0)->comment('首件(个)/首重(Kg)');
            $table->decimal('first_fee', 8, 2)->default(0)->comment('运费(元)');

            $table->decimal('additional', 8, 2)->default(0)->comment('续件/续重');
            $table->decimal('additional_fee', 8, 2)->default(0)->comment('续费(元)');

            $table->timestamps();
            $table->softDeletes();
        });
    }

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