<?php

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

class CreateAbAccountBillingTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_account_billing', function(Blueprint $table)
		{
			$table->integer('id');
			$table->integer('site_id');
			$table->bigInteger('account_id')->nullable();
			$table->integer('checkout_id');
			$table->bigInteger('service_id')->nullable();
			$table->binary('checkout_data', 65535)->nullable();
			$table->float('checkout_amount', 10, 0)->nullable();
			$table->string('notes', 128)->nullable();
			$table->primary(['id','site_id','checkout_id']);
			$table->unique(['site_id','service_id']);
			$table->index(['account_id','site_id']);
			$table->index(['service_id','site_id']);
		});
	}


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

}
