<?php

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

class CreateAbSslCaTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_ssl_ca', function(Blueprint $table)
		{
			$table->bigInteger('id');
			$table->integer('site_id');
			$table->bigInteger('account_id')->default(0);
			$table->bigInteger('date_orig')->nullable();
			$table->boolean('active')->nullable();
			$table->text('sign_pk', 65535);
			$table->text('sign_cert', 65535);
			$table->bigInteger('parent_ssl_ca_id')->nullable();
			$table->primary(['id','site_id','account_id']);
			$table->index(['parent_ssl_ca_id','site_id']);
			$table->index(['account_id','site_id']);
		});
	}


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

}
