<?php

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

class CreateAbTaxTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_tax', function(Blueprint $table)
		{
			$table->integer('id')->default(0)->primary();
			$table->bigInteger('date_orig')->nullable();
			$table->bigInteger('date_last')->nullable();
			$table->integer('country_id')->default(0)->index('fk_tax_cty_idx');
			$table->string('zone', 128)->nullable();
			$table->string('description')->nullable();
			$table->float('rate', 10, 0)->nullable();
			$table->boolean('tax_id_collect')->nullable();
			$table->string('tax_id_name', 32)->nullable();
			$table->boolean('tax_id_req')->nullable();
			$table->boolean('tax_id_exempt')->nullable();
			$table->string('tax_id_regex')->nullable();
			$table->unique(['country_id','zone'], 'UNIQUE');
		});
	}


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

}
