<?php

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

class AddColumnTableOwnersRelatingCustomer extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('owners', function (Blueprint $table) {
            $table->bigInteger('customer_id')->nullable()->index()->comment('外键客户');
            $table->decimal('tax_rate',8,2)->nullable()->comment('税率');
            $table->string('contract_number')->nullable()->comment('合同号');
            $table->string('salesman')->nullable()->comment('销售名称');
            $table->string('linkman')->nullable()->comment('联系人');
            $table->string('phone_number')->nullable()->comment('联系电话');
            $table->bigInteger('user_owner_group_id')->nullable()->index()->comment('外键工作组');
            $table->integer('waring_line_on')->nullable()->comment('月单量预警');
            $table->string('description')->nullable()->comment('描述');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('owners', function (Blueprint $table) {
            $table->dropColumn('customer_id');
            $table->dropColumn('tax_rate');
            $table->dropColumn('contract_number');
            $table->dropColumn('salesman');
            $table->dropColumn('linkman');
            $table->dropColumn('phone_number');
            $table->dropColumn('user_owner_group_id');
            $table->dropColumn('waring_line_on');
            $table->dropColumn('description');
        });
    }
}
