<?php

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

class CreateAbModuleMethodTokenTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_module_method_token', function(Blueprint $table)
		{
			$table->integer('id')->default(0);
			$table->integer('site_id')->default(0);
			$table->integer('method_id')->default(0);
			$table->bigInteger('account_id')->default(0);
			$table->string('token', 36)->default('');
			$table->bigInteger('date_orig')->default(0);
			$table->bigInteger('date_last')->nullable();
			$table->bigInteger('date_expire')->nullable();
			$table->string('uses', 45)->nullable();
			$table->primary(['id','site_id','method_id','account_id']);
			$table->index(['method_id','site_id']);
			$table->index(['account_id','site_id']);
		});
	}


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

}
