<?php

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

class CreateStockTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('stock', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('manufacturer_code', 64);
			$table->string('name', 64)->unique();
			$table->integer('buffer');
			$table->unsignedBigInteger('group_id')->index()->nullable();
			$table->enum('type', array('stock', 'non_stock', 'service'))->default('stock');
			$table->boolean('discontinued')->default(false);
			$table->unsignedBigInteger('supplier_id')->nullable();
			$table->timestamps();
		});
	}

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

}
