<?php

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

class CreateAbRtmTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_rtm', function(Blueprint $table)
		{
			$table->bigInteger('id')->default(0);
			$table->integer('site_id')->default(0);
			$table->bigInteger('account_id')->default(0);
			$table->string('name', 64)->default('')->unique('uq_name');
			$table->bigInteger('parent_id')->nullable()->index('fk_rtm_acc_p_idx');
			$table->primary(['id','site_id','account_id']);
			$table->index(['account_id','site_id'], 'fk_rtm_set_idx');
		});
	}


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

}
