<?php

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

class CreateMessagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('messages', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->default(0)->comment('归属于哪个人员');
            $table->char('lang');
            $table->string('subject');
            $table->string('name');
            $table->string('phone');
            $table->string('email');
            $table->string('company');
            $table->text('content')->nullable();
            $table->integer('product_id')->nullable();
            $table->string('ip')->nullable();
            $table->boolean('isread')->default(0);
            $table->boolean('flag')->default(0);
            $table->text('reply')->nullable();
            $table->text('notes')->nullable()->comment('分配备注信息');
            $table->string('referer')->nullable()->comment('来源页面');
            $table->string('country')->nullable()->comment('国家');
            $table->integer('valid')->default(0)->comment('询盘有效性');
            $table->timestamps();
        });
    }

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