<?php

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

return new class extends MasterMigration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->integer('level')->default(0);
            $table->integer('enabled')->default(1);
            $table->string('first_name')->nullable();
            $table->string('last_name')->nullable();
            $table->boolean('first_login_completed')->default(false);
            $table->timestamp('first_login_at')->nullable();
            $table->string('tenant_host')->nullable();
            $table->string('tenant_database')->nullable();
            $table->string('tenant_username')->nullable();
            $table->string('tenant_password')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('level');
            $table->dropColumn('enabled');
            $table->dropColumn('first_name');
            $table->dropColumn('last_name');
            $table->dropColumn('first_login_completed');
            $table->dropColumn('first_login_at');
            $table->dropColumn('tenant_host');
            $table->dropColumn('tenant_database');
            $table->dropColumn('tenant_username');
            $table->dropColumn('tenant_password');
        });
    }
};
