<?php

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

class CreateAbEmailLogTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_email_log', function(Blueprint $table)
		{
			$table->bigInteger('id')->default(0);
			$table->integer('site_id')->default(0);
			$table->bigInteger('date_orig')->nullable();
			$table->bigInteger('account_id')->default(0);
			$table->bigInteger('email_template_translate_id')->nullable();
			$table->string('email', 128)->nullable();
			$table->string('subject', 128)->nullable();
			$table->text('message')->nullable();
			$table->boolean('html')->nullable();
			$table->boolean('urgent')->nullable();
			$table->boolean('userread')->nullable();
			$table->binary('data', 65535)->nullable();
			$table->integer('module_id')->nullable();
			$table->string('module_data', 128)->nullable();
			$table->primary(['id','site_id','account_id']);
			$table->index(['email_template_translate_id','site_id']);
			$table->index(['account_id','site_id']);
			$table->index(['module_id','site_id']);
		});
	}


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

}
