<?php

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

class CreateBuyersTable extends Migration
{
    /*
     * Run the migrations.
     *
     * @return void
     */

    public function up()
    {

        /*
         * Table: buyers
         */
        Schema::create('buyers', function ($table) {
            $table->increments('id');
            $table->integer('reporting_to')->nullable();
            $table->string('name', 100)->nullable();
            $table->string('email', 100)->nullable();
            $table->string('password', 100)->nullable();
            $table->string('company_name', 100)->nullable();
            $table->string('abn', 100)->nullable();
            $table->string('title', 100)->nullable();
            $table->string('api_token', 60)->nullable();
            $table->string('remember_token', 255)->nullable();
            $table->enum('sex', ['','Male','Female'])->nullable();
            $table->date('dob')->nullable();
            $table->string('designation', 50)->nullable();
            $table->string('mobile', 100)->nullable();
            $table->string('phone', 100)->nullable();
            $table->string('address', 255)->nullable();
            $table->integer('financial_authorization')->nullable();
            $table->string('work_email', 100)->nullable();
            $table->string('alternative_phone', 100)->nullable();
            $table->string('street', 100)->nullable();
            $table->string('city', 100)->nullable();
            $table->string('district', 100)->nullable();
            $table->string('state', 100)->nullable();
            $table->integer('country')->nullable();
            $table->string('photo', 500)->nullable();
            $table->string('web', 100)->nullable();
            $table->longText('permissions')->nullable();
            $table->enum('status', ['New','Active','Suspended','Locked'])->nullable();
            $table->dateTime('email_verified_at')->nullable();
            $table->integer('user_id')->nullable();
            $table->string('user_type', 50)->nullable();
            $table->enum('user_mode', ['','admin','buyer','supplier'])->nullable();
            $table->string('upload_folder', 100)->nullable();
            $table->integer('team_id')->nullable();
            $table->string('trading_name', 100)->nullable();
            $table->string('duns_number', 100)->nullable();
            $table->string('registered_office', 100)->nullable();
            $table->string('fb_url', 100)->nullable();
            $table->string('linkedin_url', 100)->nullable();
            $table->text('directors')->nullable();
            $table->text('documents')->nullable();
            $table->package::package.fieldtype.KEY('PRIMARY')->nullable();
            $table->softDeletes();
            $table->nullableTimestamps();
        });
    }

    /*
    * Reverse the migrations.
    *
    * @return void
    */

    public function down()
    {
        Schema::drop('buyers');
    }
}