DrinkMeAlice. Admin
(drink_me_alice v0.1.0)
Copy Markdown
Short-lived administrative work under the root identity: provisioning
(namespace, database, the database-scoped runtime user) and schema
migrations. Never pooled, never a process — each call opens its own
DrinkMeAlice.Session, runs, and closes.
The runtime identity is separate: provision/4 defines a
database-scoped EDITOR user and nothing here keeps admin material.
Credentials never enter logs or error values.
config is a Session config whose user/pass are the ROOT
credentials (signin: :root is the default).
Every value spliced
into DDL is validated first: names must be identifiers
(DrinkMeAlice.identifier?/1), durations must match <n><unit>, and the
runtime password must be 1–128 bytes of [A-Za-z0-9_.~-] — so no
quote or statement separator can reach the SQL text.
Summary
Functions
Apply migrations (see DrinkMeAlice.Migrations) through one root
session. Options: owner (default a fresh UUIDv4), reply_budget_ms
(5_000..60_000, default 5_000 — widen for migrations whose audit
statements scan large tables; a reply wait, not a cancellation),
plus anything the migrations' own vars functions read.
Define the namespace/database if absent and the database-scoped runtime
EDITOR user. Options: token_dur (default "1h"), session_dur
(default "8h").
Force-overwrite the runtime user's credentials (rotation / recovery).
Functions
@spec migrate(map() | keyword(), [DrinkMeAlice.Migrations.migration()], keyword()) :: :ok | {:error, term()}
Apply migrations (see DrinkMeAlice.Migrations) through one root
session. Options: owner (default a fresh UUIDv4), reply_budget_ms
(5_000..60_000, default 5_000 — widen for migrations whose audit
statements scan large tables; a reply wait, not a cancellation),
plus anything the migrations' own vars functions read.
Define the namespace/database if absent and the database-scoped runtime
EDITOR user. Options: token_dur (default "1h"), session_dur
(default "8h").
@spec rotate_runtime_user(map() | keyword(), binary(), binary(), keyword()) :: :ok | {:error, term()}
Force-overwrite the runtime user's credentials (rotation / recovery).