<?php

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

class CreateBranchUsersTable extends Migration {

	public function up()
	{
		Schema::create('branch_users', function(Blueprint $table) {
			$table->increments('id');
			$table->integer('branch_id')->unsigned()->nullable();
			$table->foreign('branch_id')->references('id')->on('branches');
            $table->bigInteger('user_id')->unsigned()->nullable();
            $table->foreign('user_id')->references('id')->on('users');

            $table->softDeletes();
            $table->timestamps();
            $table->engine = 'InnoDB';
		});
	}

	public function down()
	{
		Schema::drop('branch_users');
	}
}