<?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::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('username')->unique()->index();
            $table->string('password');
            $table->string('email')->unique()->index();
            $table->integer('role_id')->default(6)->index();
            $table->string('avatar')->default('default.png');
            $table->string('coverpic')->default('default.png');
            $table->text('bio')->nullable()->default(null);
            $table->string('status')->nullable()->default(null);
            $table->string('api_token')->nullable()->default(null);
            $table->string('stripe_id')->nullable()->default(null);
            $table->integer('profile_views')->default(0);
            $table->integer('blog_views')->default(0);
            $table->enum('banned', ['Y', 'N'])->default('N');
            $table->enum('user_deleted', ['Y', 'N'])->default('N');
            $table->timestamp('email_verified_at')->nullable();
            $table->rememberToken();
            $table->ipAddress();
            $table->timestamps();
            $table->timestamp('last_activity')->nullable()->default(null);
            $table->softDeletes();
        });
    }

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