<?php

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

class CreateStockPurchaseOrdersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('stock_purchase_orders', function($table){

			$table->increments('id');
			$table->unsignedBigInteger('supplier_id')->index();
			$table->unsignedBigInteger('status_id')->index();
			$table->string('reference_number',64);
			$table->double('delivery_cost')->default(0);
			$table->double('items_cost');
			$table->double('discount_amount')->default(0);
			$table->double('total_vat')->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_orders');
	}

}
