<?php

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

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

        Schema::create('real_companies', function (Blueprint $table) {
            $table->increments('id')->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->timestamps();
            $table->softDeletes();

            $table->unique(['sn', 'deleted_at']);
            $table->comment("RD企业");
        });
    }

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