<?php

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

class CreateStocksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('stocks', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('issue_note_id')->nullable();
            $table->unsignedInteger('receiving_note_id')->nullable();
            $table->unsignedInteger('branch_id')->nullable();
            $table->unsignedInteger('item_id')->nullable();
            $table->double('in_quantity')->nullable();
            $table->double('out_quantity')->nullable();
            $table->double('unit_price')->nullable();
            $table->timestamp('date')->nullable();
            $table->enum('is_recycle', ['0','1','2'])->default('0');
            $table->timestamps();
        });
    }

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