<?php

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

class CreateLeadsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('leads', function (Blueprint $table) {
            $table->id();
            $table->text('description')->nullable();
            $table->enum('lead_status',['pending','on_hold','converted','cancelled'])->nullable();
            $table->bigInteger('assign_to_user_id')->nullable()->unsigned();
            $table->foreign('assign_to_user_id')->references('id')->on('users');
            $table->bigInteger('created_by_user_id')->nullable()->unsigned();
            $table->foreign('created_by_user_id')->references('id')->on('users');
            $table->string('reference_no')->nullable();
            $table->bigInteger('client_id')->nullable()->unsigned();
            $table->foreign('client_id')->references('id')->on('clients');
            $table->timestamps();
        });
    }

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