<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->string('password')->nullable()->change(); // social login requires no pw (still required upon normal reg)
            $table->string('registrationIp')->nullable()->change();

            $table->unsignedBigInteger('discord_user_id')->after('remember_token')->nullable();
            $table->longText('discord_token')->after('discord_user_id')->nullable();
            $table->longText('discord_refresh_token')->after('discord_token')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('discord_token', 'discord_refresh_token', 'discord_user_id');

            $table->string('password')->nullable(false)->change();
            $table->string('registrationIp')->nullable(false)->change();
        });
    }
};
