<?php

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

class CreateAbInvoiceItemDiscountTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_invoice_item_discount', function(Blueprint $table)
		{
			$table->integer('id')->nullable();
			$table->integer('site_id')->nullable();
			$table->bigInteger('date_orig')->nullable()->index();
			$table->bigInteger('invoice_id')->nullable();
			$table->bigInteger('account_id')->nullable()->index();
			$table->bigInteger('invoice_item_id')->nullable();
			$table->string('discount', 64)->nullable()->index();
			$table->float('amount', 10, 0)->nullable();
			$table->unique(['site_id','id'], );
			$table->index(['invoice_id','invoice_item_id']);
		});
	}


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

}
