<?php

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

class UpdateUsersTableWithSocial extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('table_user', function (Blueprint $table) {

            $table->string('fb_id')->nullable();
            $table->string('google_id')->nullable();

            $table->index('fb_id');
            $table->index('google_id');

            /** Not work with nullable(); !!!!!

            $table->dropIndex('table_user_email_index');
            $table->dropIndex('table_user_nickname_index');

            $table->unique('nickname', 'unique_nickname');
            $table->unique('email', 'unique_email');

            */

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('table_user', function (Blueprint $table) {

            $table->dropIndex('fb_id');
            $table->dropIndex('google_id');

            $table->dropColumn('fb_id');
            $table->dropColumn('google_id');

            /** Not work with nullable(); !!!!!

            $table->dropUnique('unique_nickname');
            $table->dropUnique('unique_email');

            $table->index('nickname');
            $table->index('email');

            */

        });
    }
}
