<?php

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

class CreateVirtualAgentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('virtual_agents', function (Blueprint $table) {
            $table->increments('id')->comment('代理商ID');
            $table->integer('company_id')->unsigned()->default(0)->comment('企业ID');
            $table->string('sn', 32)->comment('代理商编号');
            $table->string('name', 32)->default('')->comment('代理商名称');
            $table->string('contacts', 20)->default('')->comment('联系人');
            $table->string('mobile', 20)->default('')->comment('手机号');
            $table->string('address')->default('')->comment('地址');
            $table->text('remark')->nullable()->comment('订单备注');
            $table->text('extends')->nullable()->comment('扩展信息');
            $table->tinyInteger('status')->unsigned()->default(0)->comment('状态 0:正常 1:禁用');
            $table->timestamps();
            $table->softDeletes();

            $table->unique(['sn', 'deleted_at']);
            $table->comment("VD代理商");
        });
    }

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