Skip to main content

Module admin

Module admin 

Source
Expand description

Creating the first admin user (gize createadmin, ADR-017).

Connects with SQLx’s AnyPool (like crate::migrate) so one code path serves Postgres, SQLite and MySQL. Because the Any driver passes SQL through unchanged, the INSERT uses the dialect’s own placeholder style and id strategy — and binds the id as raw bytes so the stored value is byte-for-byte what the generated app reads back for its uuid::Uuid id.

Functions§

create
Insert an admin user (is_admin = true) into the users table. password_hash must already be an Argon2 PHC string (see gize-auth). Rejects a duplicate email up front and reports a missing users table with guidance to migrate first.