<?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->unsignedBigInteger('client_id');
			$table->enum('client_type', array('customer', 'client'))->default('customer');
			$table->unsignedBigInteger('site_user')->nullable();
			$table->unsignedBigInteger('assigned_to')->nullable();
			$table->text('message');
			$table->enum('status', array('not_read', 'read'))->default('not_read');
			$table->timestamps();
		});
	}

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

}
