<?php

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

class CreateAbInvoiceItemTaxTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_invoice_item_tax', function(Blueprint $table)
		{
			$table->bigInteger('id')->default(0);
			$table->integer('site_id')->default(0);
			$table->bigInteger('date_orig')->nullable();
			$table->bigInteger('invoice_item_id')->default(0);
			$table->integer('tax_id')->default(0)->index('fk_iit_tax_idx');
			$table->float('amount', 10, 0)->default(0);
			$table->primary(['id','site_id','invoice_item_id','tax_id']);
			$table->index(['invoice_item_id','site_id'], 'fk_iit_ii_idx');
		});
	}


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

}
