<?php

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

class CreateSocialIdentitiesTable extends Migration
{
    /**
     * Run the migration.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('social_identities', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->unsigned();
            $table->string('provider');
            $table->string('reference');
            $table->text('access_token');
            $table->string('expires_at')->nullable();
            $table->string('refresh_token')->nullable();
            $table->string('confirm_token')->default('');
            $table->dateTime('confirm_until')->nullable();
            $table->dateTime('confirmed_at')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migration.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('social_identities');
    }
}

<?php

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

class CreateSocialIdentitiesTable extends Migration
{
    /**
     * Run the migration.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('social_identities', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->unsigned()->index();
            $table->string('provider');
            $table->string('reference');
            $table->text('access_token');
            $table->string('expires_at')->nullable();
            $table->string('refresh_token')->nullable();
            $table->string('confirm_token')->default('');
            $table->dateTime('confirm_until')->nullable();
            $table->dateTime('confirmed_at')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migration.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('social_identities');
    }
}

Add index to user_id on social_identities for speeding up searches with lots of records.
Add index to user_id on social_identities for speeding up searches with lots of records.
