<?php

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

class AddForeignKeysToAbInvoiceItemTaxTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('ab_invoice_item_tax', function(Blueprint $table)
		{
			$table->foreign('invoice_item_id', 'fk_iit_ii')->references('id')->on('ab_invoice_item')->onUpdate('NO ACTION')->onDelete('NO ACTION');
			$table->foreign('tax_id', 'fk_iit_tax')->references('id')->on('ab_tax')->onUpdate('NO ACTION')->onDelete('NO ACTION');
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::table('ab_invoice_item_tax', function(Blueprint $table)
		{
			$table->dropForeign('fk_iit_ii');
			$table->dropForeign('fk_iit_tax');
		});
	}

}
