File: /home/mmickelson/spilicensing/database/migrations/2016_03_24_232348_create_licenses_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateLicensesTable extends Migration {
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('licenses', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('licenseKey')->index('licenseKey');
			$table->integer('maxActivations');
			$table->date('expiration')->nullable();
			$table->string('duration', 10)->nullable()->default('1 YEAR');
			$table->integer('licenseType_id')->unsigned();
			$table->integer('product_id')->unsigned();
			$table->integer('subproduct_id')->unsigned();
			$table->integer('vendor_id')->unsigned();
			$table->integer('purchaser_id')->nullable()->unsigned();
			$table->timestamps();
		});
		Schema::table('licenses', function($table)
		{
			$table->foreign('licenseType_id')->references('id')->on('license_types');
			$table->foreign('product_id')->references('id')->on('products');
			$table->foreign('subproduct_id')->references('id')->on('subproducts');
			$table->foreign('vendor_id')->references('id')->on('vendors');
			$table->foreign('purchaser_id')->references('id')->on('purchasers');
		});
	}
	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('licenses');
	}
}