<?php

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

class AddCustomerTempUrlToWaybillsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        if (Schema::hasColumns('waybills', ["customer_temp_url"])) {
            return;
        }
        Schema::table('waybills', function (Blueprint $table) {
            $table->string('customer_temp_url', 191)->default('')->comment('自定义模版url');
            $table->text('customer_temp_data')->nullable()->comment('自定义模版参数');
        });

    }

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