<?php

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

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->id();
            $table->string('name',100)->nullable();
            $table->string('goodsCode', 15);
            $table->integer('genre_id')->unsigned();
            // $table->integer('unit_id')->unsigned();
            $table->float('purchases_price',12,2)->nullable();
            $table->float('sale_price',12,2)->nullable();
            // $table->float('low_stock',12,2)->nullable();
            $table->string('thumbnail')->nullable();
            $table->enum('status', ['Active', 'Inactive', 'Pending'])->default('Active')->comment('default status set active , penidng status waiting for approbal');
            $table->integer('updated_by')->nullable();
            $table->integer('created_by')->nullable();
            $table->integer('deleted_by')->nullable();
            $table->index('genre_id');
            $table->softDeletes();
            $table->timestamps();
        });
    }

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