<?php

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

class CreateDevicesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('devices', function (Blueprint $table) {
            $table->id();
            $table->string('serial');
            $table->string('brand')->nullable();
            $table->text('extentions')->nullable();
            $table->unsignedInteger('type'); //is mobile or computer
            $table->string('color')->nullable();
            $table->text('photo')->nullable();
            $table->text('notice')->nullable();
            $table->text('done_notice')->nullable();
            $table->unsignedInteger('state')->default(1); // 1, 2 stock, out stock
            $table->timestamps();
            $table->index(['serial']);
        });
    }

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