<?php

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

class AddTimedDeliveryCodeToShopSendersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasColumns('shop_senders', ['timed_delivery_code'])) {
            return;
        }
        Schema::table('shop_senders', function (Blueprint $table) {
            $table->integer('timed_delivery_code')->default(247)->comment('地址类型: 247-电商标快,266-空运');
        });
    }

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