<?php

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

class CreateAbExportDatamapTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_export_datamap', function(Blueprint $table)
		{
			$table->bigInteger('id')->default(0);
			$table->integer('site_id')->default(0);
			$table->bigInteger('export_module_id')->default(0);
			$table->bigInteger('date_orig')->nullable();
			$table->bigInteger('date_last')->nullable();
			$table->boolean('active')->nullable();
			$table->bigInteger('item_id')->nullable();
			$table->integer('module_id');
			$table->binary('map_data', 65535)->nullable();
			$table->primary(['id','site_id','export_module_id','module_id']);
			$table->unique(['item_id','export_module_id','site_id']);
			$table->index(['export_module_id','site_id']);
			$table->index(['module_id','site_id']);
		});
	}


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

}
