<?php

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

class CreateAbModuleTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_module', function(Blueprint $table)
		{
			$table->integer('id')->default(0);
			$table->integer('site_id')->default(0)->index();
			$table->string('name', 128)->default('');
			$table->bigInteger('date_orig')->nullable();
			$table->boolean('active')->nullable();
			$table->integer('parent_id')->nullable();
			$table->text('notes')->nullable();
			$table->boolean('external')->nullable();
			$table->primary(['id','site_id']);
			$table->unique(['site_id','name']);
			$table->index(['parent_id','site_id']);
		});
	}


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

}
