<?php

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

class CreateStockPurchaseOrderItemsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('stock_purchase_order_items', function($table){
						
			$table->increments('id');
			$table->unsignedBigInteger('stock_purchase_order_id')->index();
			$table->unsignedBigInteger('stock_id')->index();
			$table->double('unit_cost');
			$table->double('unit_vat');
			$table->integer('quantity');
			$table->integer('received_quantity')->default(0);
			$table->integer('refused_quantity')->default(0);
			$table->unsignedBigInteger('created_by')->nullable();
			$table->unsignedBigInteger('updated_by')->nullable();
			$table->softDeletes();
			$table->timestamps();
		});
	}

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