<?php

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

class CreateFacilityUsers extends Migration {

	/**
	* Run the migrations.
	*
	* @return void
	*/
	public function up()
	{
		Schema::create('facility_users', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('username');
			$table->string('name');
			$table->string('gender');
			$table->string('phone');
			$table->string('email');
			$table->integer('district_id')->unsigned();
			$table->integer('facility_id')->unsigned();
			$table->timestamps();


			$table->foreign('district_id')->references('id')->on('districts')
			->onUpdate('cascade')->onDelete('cascade');
			$table->foreign('facility_id')->references('id')->on('hubs')
			->onUpdate('cascade')->onDelete('cascade');
		});
	}


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

}
