<?php

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

return new class extends Migration
{
    public string $migration;

    /**
     * Run the migrations.
     *
     * @return void
     */
    public static function up(): void
    {
        \kernel\App::$db->schema->create('user', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username', 255)->nullable(false);
            $table->string('email', 255);
            $table->string('password_hash', 255);
            $table->integer('role')->default(1);
            $table->string('access_token', 255)->nullable(true);
            $table->dateTime('access_token_expires_at')->nullable(true);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public static function down(): void
    {
        \kernel\App::$db->schema->dropIfExists('user');
    }
};
