<?php

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

class AddUserIdToCustomersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('Customers', function(Blueprint $table)
		{
			$table->integer("user_id")->unsigned()->nullable();;
		});
		Schema::table("Customers",function(Blueprint $table)
		{
			$table->foreign("user_id")->references("id")->on("Users")->onDelete("cascade")->onUpdate("cascade");
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop("Customers");
		Schema::table("Customers",function(Blueprint $table)
		{
			$table->dropForeign("'Customer_user_id_foreign'");
		});

	}

}
