<?php

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

class CreateVirtualCompanyAddressesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable('virtual_company_addresses')) {
            return;
        }

        Schema::create('virtual_company_addresses', function (Blueprint $table) {
            $table->increments('id')->comment('自增ID');
            $table->integer('company_id')->unsigned()->default(0)->comment('企业ID');
            $table->string('contacts', 20)->default('')->comment('联系人');
            $table->string('mobile', 20)->default('')->comment('手机号');
            $table->string('area')->default('')->comment('区域');
            $table->string('address')->default('')->comment('地址');
            $table->tinyInteger('default')->unsigned()->default(0)->comment('是否默认 0:不是 1:是');
            $table->tinyInteger('status')->unsigned()->default(0)->comment('状态 0:正常 1:禁用');
            $table->timestamps();
            $table->softDeletes();

            $table->comment('VD企业收货地址表');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('virtual_company_addresses');
    }
}
