<?php

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

class CreateInvitesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if(!Schema::hasTable('invites')) {
            Schema::create('invites', function (Blueprint $table) {
                $table->bigIncrements('id');
                $table->string('email');
                $table->string('token')->unique();
                $table->timestamps();
                $table->bigInteger('created_by')->nullable();
                $table->string('notified', 45)->nullable();
                $table->bigInteger('notification_id')->nullable();
            });
        }
    }

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