Skip to content

The data model

What the engine stores in your database, table by table, the roles it creates, and how row-level security ties them together.

Applies to EngineCloud
View as Markdown
On this page
  1. sypnia_auth
  2. sypnia_data
  3. Roles

The engine’s tables live in two schemas of your own database. Your tables live wherever you put them; they only meet the engine’s through sypnia_auth.users(id) and the helper functions.

Figure. The sypnia_auth schema. A user has identities and sessions; a session has a chain of refresh tokens; machines, tokens and keys sit beside them.
  1. users: one row per person, identity only.
  2. sessions: one per signed-in device or machine sign-in, with its policy.
  3. oauth_clients: one per machine allowed to ask for tokens.

sypnia_auth

TableHoldsSecrets stored as
userse-mail, phone, password hash, confirmation times, app_metadata (server only), user_metadata (the user’s), banned_until, deleted_atargon2id
identitieseach way a user signs in: e-mail, Google, GitHub—
sessionsuser or client, the policy that applied, aal, last refresh, not_after, user agent, IP prefix—
refresh_tokensone row per token, its session and its parent (the rotation chain), revoked_atSHA-256
one_time_tokensconfirmation, recovery, magic link, invite, e-mail change, reauthentication; attempts and expirySHA-256
flow_statethe PKCE state of provider sign-ins and authorization codesSHA-256
oauth_clientsmachines: authentication method, public keys, scopes, resources, DPoP, policyargon2id (secrets)
assertion_jticlient assertion ids already used, until they expire—
device_codespending device-flow approvalsSHA-256
personal_access_tokensowner, name, scopes, expiry, last useSHA-256
api_keyspublishable and secret keysSHA-256 (secret)
rate_limitscounters per window and key—
audit_logevery auth event—

sypnia_data

TableHolds
migrationsapplied migrations: version, name, checksum, when, by whom
sql_auditstatements run through the SQL endpoint
settingsthe project’s settings: session policy, providers, e-mail, templates, limits (credentials encrypted)
signing_keysEd25519 key pairs; the private half encrypted with the project’s data key

Roles

Text
anon, authenticated, service_role     NOLOGIN   requests run as one of these
sypnia_authenticator                  LOGIN     the engine's connection: no rights, member of the three above (NOINHERIT)
sypnia_admin                          owner of your schemas; SQL endpoint and migrations

sypnia_authenticator can do nothing until the engine runs set local role for a request; then it has exactly that role’s rights, and your row-level security applies.

  1. sypnia_auth
  2. sypnia_data
  3. Roles

    Search pages, sections and terms