docs: update documentation to OKF v0.1 format

This commit is contained in:
OpenVelo Agent
2026-07-23 13:28:26 +00:00
parent e611d201d9
commit 3a20f8ee3c
4 changed files with 42 additions and 6 deletions
+11 -1
View File
@@ -3,7 +3,7 @@ type: database
title: User Table
description: The `user` table — accounts, roles, and statuses.
tags: [database, user, auth]
timestamp: 2026-07-21T17:37:18Z
timestamp: 2026-07-23T13:27:25Z
---
# Schema
@@ -31,6 +31,16 @@ timestamp: 2026-07-21T17:37:18Z
demote or delete the last admin are rejected by
`UsersService.enforceLastAdminInvariant` (used by
`AdminService.updateUserRole` and `AdminService.deleteUser`).
- A deployment-wide database safety net backs the invariant up at the
SQLite level via two triggers created by the
`AddUserLastAdminTriggers1700000000800` migration:
`trg_user_last_admin_update` (fires on `UPDATE OF role` when the old
row was admin, the new role is not, and no other admin row exists)
and `trg_user_last_admin_delete` (fires on `DELETE` of an admin row
when no other admin row exists). Both abort the offending statement
with `RAISE(ABORT, 'LAST_ADMIN')`. They are recreated by the restore
rebuild after the candidate database is rebuilt — see
[Admin System Endpoints — POST /restore/commit](/api/admin-system.md).
# First-admin bootstrap