<?php

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

class CreateAbExportItemTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_export_item', 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->bigInteger('item_id')->default(0);
			$table->string('reference', 64)->nullable();
			$table->string('crc', 128)->nullable();
			$table->primary(['id','site_id','export_module_id']);
			$table->unique(['site_id','export_module_id','item_id']);
			$table->index(['export_module_id','site_id']);
		});
	}


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

}
