<?php

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

class ChangeWaybillsTableAddOrderIdColumn extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('waybills', function (Blueprint $table) {
            $table->bigInteger("order_id")->index()->nullable()->comment("订单");
            $table->bigInteger('owner_id')->nullable()->comment('货主')->change();
            $table->string('destination',50)->nullable()->comment('目的地')->change();
            $table->string('recipient',50)->nullable()->comment('收件人')->change();
            $table->string('recipient_mobile',50)->nullable()->comment('收件人电话')->change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('waybills', function (Blueprint $table) {
            $table->dropColumn("order_id");
            $table->bigInteger('owner_id')->comment('货主')->change();
            $table->string('destination',50)->comment('目的地')->change();
            $table->string('recipient',50)->comment('收件人')->change();
            $table->string('recipient_mobile',50)->comment('收件人电话')->change();
        });
    }
}
