<?php

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

class AddZapierSupport extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
    Schema::create('subscriptions', function($table)
    {
      $table->increments('id');
      $table->unsignedInteger('account_id')->nullable();

      $table->timestamps();
      $table->softDeletes();

      $table->unsignedInteger('event_id')->nullable();
      $table->string('target_url');

      $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
      $table->unique( ['account_id', 'event_id'] );
    });

	}

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

}
