<?php

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

class CreateAbInvoiceTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_invoice', function(Blueprint $table)
		{
			$table->bigInteger('id')->default(0);
			$table->integer('site_id')->default(0);
			$table->bigInteger('date_orig')->nullable();
			$table->bigInteger('date_last')->nullable();
			$table->boolean('process_status')->nullable();
			$table->boolean('billing_status')->nullable();
			$table->boolean('print_status')->nullable();
			$table->bigInteger('account_id')->default(0);
			$table->integer('account_billing_id')->nullable();
			$table->float('discount_amt', 10, 0)->nullable();
			$table->bigInteger('due_date')->nullable();
			$table->boolean('active')->nullable();
			$table->binary('reminders', 65535)->nullable();
			$table->primary(['id','site_id','account_id']);
			$table->index(['account_id','site_id'], 'fk_inv_acc_idx');
		});
	}


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

}
