<?php
declare(strict_types=1);

use Celena\Core\Database\Blueprint;
use Celena\Core\Database\Connection;
use Celena\Core\Database\Schema;

return function (Schema $schema, Connection $conn): void {
    $schema->create('celena_users', function (Blueprint $t) {
        $t->id();
        $t->string('email', 191);
        $t->string('password_hash', 255);
        $t->string('name', 191);
        $t->string('role', 32)->default('user');
        $t->boolean('is_active')->default(true);
        $t->string('locale', 8)->default('ru');
        $t->string('totp_secret', 64)->nullable();
        $t->datetime('last_login_at')->nullable();
        $t->timestamps();
        $t->unique('email');
        $t->index('role');
    });
};
