<?php

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

class ChangeOwnerOperationPriceTableAddOddPriceColumn extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('owner_price_operation_items', function (Blueprint $table) {
            $table->decimal("odd_price")->nullable()->comment("零头价");
        });
        Schema::table('waybills', function (Blueprint $table) {
            $table->tinyInteger("is_to_pay")->default(0)->comment("是否到付");
        });
        Schema::table('owner_price_operations', function (Blueprint $table) {
            $table->decimal("surcharge")->nullable()->comment("附加费");
            $table->bigInteger("surcharge_unit_id")->nullable()->comment("附加费单位");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('owner_price_operation_items', function (Blueprint $table) {
            $table->dropColumn("odd_price");
        });
        Schema::table('waybills', function (Blueprint $table) {
            $table->dropColumn("is_to_pay");
        });
        Schema::table('owner_price_operations', function (Blueprint $table) {
            $table->dropColumn("surcharge");
            $table->dropColumn("surcharge_unit_id");
        });
    }
}
