<?php

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

class CreateAbServiceSslTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ab_service__ssl', function(Blueprint $table)
		{
			$table->bigInteger('id');
			$table->integer('site_id');
			$table->bigInteger('service_id');
			$table->bigInteger('ssl_ca_id')->nullable();
			$table->text('csr', 65535);
			$table->text('pk', 65535)->nullable();
			$table->text('cert', 65535)->nullable();
			$table->primary(['id','service_id','site_id']);
			$table->unique(['id','site_id'], 'UNIQUE');
			$table->index(['service_id','site_id'], 'fk_ss_svc_idx');
			$table->index(['ssl_ca_id','site_id'], 'fk_ss_sca_idx');
		});
	}


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

}
